-
Notifications
You must be signed in to change notification settings - Fork 24
Quick Start: Add Caching
Adding caching is very similar to adding a quota.
- First, update your
package.json
file in your project to include thevolos-cache-memory":
module under
"dependencies": {
"express": "",
"a127-magic": "",
"volos-cache-memory": ""
}
Note: You can also use a cache implementation that uses Redis or Apigee as its provider. More information here.
-
Run,
npm install
. -
Execute
a127 project edit
to open up the Swagger editor. -
In the Swagger configuration file, under
x-volos-resources
, add the following to enable an in-memory cache provider named 'cache' that you refer to later:
cache:
provider: volos-cache-memory
options:
name: weather-cache
ttl: 60000
- Finally, use
x-volos-apply
to apply this policy to the paths you want to enforce quotas on, referencing the resource you defined in the previous step:
paths:
/weather:
x-swagger-router-controller: weather
x-volos-authorizations: {}
x-volos-apply:
quota: {}
cache: {}
Now, try running the app as in the quickstart and try using the curl command:
a127 project start
curl http://localhost:10010/weather\?city\=San%20Jose,CA
You can also add quotas, OAuth, analytics, and deploy to Apigee.
Having Trouble? Try posting your question to the Apigee Community. Or, for more links and resources, check out our Help Page
Need help? Visit the Apigee Community ! |
---|
-
Getting started
-
Add policies to your API
-
Add security policies
-
Deploy your projects
-
Programmatic hooks
-
Good to know about
-
Deep dives
-
Reference topics
-
Troubleshooting and getting help
-
Related resources