forked from playframework/playframework
-
Notifications
You must be signed in to change notification settings - Fork 0
JavaCache
Guillaume Bort edited this page Feb 6, 2012
·
11 revisions
The default implementation of the Cache api use EHCache. You can also provide your own implementation via a plugin.
The cache api is provided by the play.cache.Cache object. It requires to have at least a cache plugin registered.
Note: The API is voluntary minimal to allow several implementation tu be plugged. If you need a more specific API, use the one provided by your Cache plugin.
Using this simple API you can either store data in cache:
Cache.set("item.key", connectedUser)
And then retrive it later:
User maybeUser = Cache.get("item.key")
You can easily create smart cached action using standard Action composition.
Note: Play HTTP
Resultare safe to cache and reuse later.
Play provide a default built-in helper for standard cases:
@Cached("homePage")
public static Result index() {
return ok("Hello world");
}
Next: Calling WebServices
- HTTP programming
- Asynchronous HTTP programming
- The template engine
- HTTP form submission and validation
- Working with JSON
- Working with XML
- Handling file upload
- Accessing an SQL database
- Using the Cache
- Calling web services
- Integrating with Akka
- Internationalization
- The application Global object
- Testing your application