Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.48 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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)