Nelly's Rose Valley Cache (GCG4TQ) was created by Les Bonhommes on 5/18/2003. It's a Regular size geocache, with difficulty of 2, terrain of 3.5. It's located in British Columbia, Canada.This cache is in Rose Valley, we set the cache using this entrance 49 degrees 53.086 N 119 degrees 33.630W In a clear plastic container you will find it. Clearing cache can fix some browsing problems, free up space, and remove saved versions of visited pages for privacy reasons. Most browsers let you clear cache quickly via Ctrl+Shift+Del (Windows) or Command+Shift+Delete (Mac). Otherwise, try your browser's Settings, Privacy, or Advanced options. What Exactly Is Cache?
Memorystore for Redis is a fully managed Redis service for Google Cloud. Apps running on Google Cloud can achieve extreme performance by leveraging the highly scalable, available, and secure Redis service without the burden of managing complex Redis deployments. It can be used as a backend for data caching to improve the performance of Spring Boot apps. The codelab explains how to set it up.
Note: You can easily access Cloud Console by memorizing its URL, which is console.cloud.google.com.
Remember the project ID, a unique name across all Google Cloud projects (the name above has already been taken and will not work for you, sorry!). It will be referred to later in this codelab as PROJECT_ID
.
Note: If you're using a Gmail account, you can leave the default location set to No organization. If you're using a G Suite account, then choose a location that makes sense for your organization.
Running through this codelab shouldn't cost much, if anything at all. Be sure to to follow any instructions in the 'Cleaning up' section which advises you how to shut down resources so you don't incur billing beyond this tutorial. New users of Google Cloud are eligible for the $300USD Free Trial program.
If you've never started Cloud Shell before, you'll be presented with an intermediate screen (below the fold) describing what it is. If that's the case, click Continue (and you won't ever see it again). Here's what that one-time screen looks like:
It should only take a few moments to provision and connect to Cloud Shell.
This virtual machine is loaded with all the development tools you'll need. It offers a persistent 5GB home directory and runs in Google Cloud, greatly enhancing network performance and authentication. Much, if not all, of your work in this codelab can be done with simply a browser or your Chromebook.
Once connected to Cloud Shell, you should see that you are already authenticated and that the project is already set to your project ID.
Command output
Note: The gcloud
command-line tool is the powerful and unified command-line tool in Google Cloud. It comes preinstalled in Cloud Shell. You will notice its support for tab completion. For more information, see gcloud command-line tool overview.
Command output
If it is not, you can set it with this command:
Command output
Start Cloud Shell.
After Cloud Shell launches, use the command line to enable the Memorystore API and create a new Memorystore instance.
After the operation completes, your instance will be ready to use.
Get the redis host ip-address of the instance by running the following command. You will use it again later when configuring your Spring Boot app.
In Google Cloud Console, navigate to Databases > Memorystore > Redis. Your instance should be in the 'ready' state :
Create a Compute Engine instance in the same region.
After the operation completes, your instance will be ready to use.
Connect to your instance via SSH with the following command:
Alternatively, navigate to Compute > Compute Engine > VM instances, and click SSH in the Connect column:
In the virtual machine (VM) instance shell (not Cloud Shell), install OpenJDK, Maven, and Redis tools:
Wait for the installation to complete and then proceed to the next step.
Evernote web access. Create a new Spring Boot project with web
, redis
and cache
dependencies:
Edit the application.properties
file to configure the app to use the IP address of the Memorystore instance for Redis host.
Add the following line with your Memorystore for Redis IP address (from a couple steps ago):
Add a new line after that and create a REST controller Java class:
Put the following content into the file:
The @RequestMapping
annotation exposes the method as an HTTP endpoint and maps part of the path to a method parameter (as indicated by the @PathVariable
annotation).
The @Cacheable('hello')
annotation indicates that the method execution should be cached and the cache name is 'hello
.' It's used in combination with the parameter value as a cache key. You'll see an example later in the code lab.
Next, we'll enable caching in the Spring Boot app class. Edit DemoApplication.java
:
Import org.springframework.cache.annotation.EnableCaching
and annotate the class with this annotation. The result should look like this:
Now you're ready to run the app!
Open another SSH connection to your instance the same way that you did earlier. In the new SSH window, access the /hello/
endpoint multiple times, passing 'bob
' as name.
Notice that the first time the request took five seconds, but the next one was significantly faster despite the fact that you have Thread.sleep(5000)
invocation in the method. That's because the actual method was executed only once and the result was put into the cache. Every subsequent call returns the result directly from the cache.
You can actually see exactly what the app cached. From the same terminal that you used in the previous step, connect to Memorystore for Redis host using redis-cli:
To see the list of cache keys, use the following command:
As you can see, the cache name is used as a prefix for the key and the parameter value is used as the second part.
To retrieve the value, use the GET
command:
Use the exit
command to exit.
To clean up, delete Compute Engine and Memorystore instances from Cloud Shell.
Delete the compute instance:
Delete the Memorystore for Redis instance:
You created Memorystore for Redis and a Compute Engine instance. Also, you configured a Spring Boot app to use Memorystore with Spring Boot caching!
This work is licensed under a Creative Commons Attribution 2.0 Generic License.
File Info | Description |
---|---|
File Size: | 24 kB |
File Modification Date/Time: | 2019:12:09 14:57:38+00:00 |
File Type: | Win32 EXE |
MIME Type: | application/octet-stream |
Machine Type: | Intel 386 or later, and compatibles |
Time Stamp: | 2019:08:19 10:27:25+00:00 |
PE Type: | PE32 |
Linker Version: | 14.16 |
Code Size: | 7680 |
Initialized Data Size: | 8192 |
Uninitialized Data Size: | 0 |
Entry Point: | 0x2191 |
OS Version: | 6.0 |
Image Version: | 0.0 |
Subsystem Version: | 6.0 |
Subsystem: | Windows command line |
File Version Number: | 79.0.0.44422 |
Product Version Number: | 79.22844.0.0 |
File Flags Mask: | 0x003f |
File Flags: | (none) |
File OS: | Windows NT 32-bit |
Object File Type: | Executable application |
File Subtype: | 0 |
Language Code: | English (U.S.) |
Character Set: | Unicode |
Company Name: | Adobe |
File Description: | TQCacheCleaner |
File Version: | O |
Internal Name: | TQCacheCleaner.exe |
Legal Copyright: | Copyright © 2013-2019, Adobe Inc. All rights reserved. |
Product Name: | TQCacheCleaner |
Product Version: | 79.612668 |
✻ Portions of file data provided by Exiftool (Phil Harvey) distributed under the Perl Artistic License.