Advertisement
Guest User

Untitled

a guest
Jan 4th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. def get(key: String) = Cached("key-" + key, duration = 3600) {
  2. Action {
  3. Ok(some_method)
  4. }
  5. }
  6.  
  7. Cache.set("item.key", null, 0)
  8.  
  9. public static Result index() {
  10. Result cachedResult = (Result) Cache.get("applicationIndex");
  11. if (cachedResult == null) {
  12. Result res = ok(index.render("Ready " + Math.random()));
  13. Cache.set("applicationIndex", res, 5);
  14. cachedResult = res;
  15. }
  16. return cachedResult;
  17. }
  18.  
  19. Cache.set("applicationIndex", null, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement