Package play.cache

Examples of play.cache.Cached


    if (cacheForVal == null) {
      // the cache has not been filled up yet.
      Method[] mths = class1.getDeclaredMethods();
      for (Method m : mths) {
        if (m.getName().equalsIgnoreCase(actionName) && Modifier.isPublic(m.getModifiers())) {
            Cached cacheFor = m.getAnnotation(Cached.class);
            if (cacheFor == null) {
              // well no annotation level cache spec
              cacheForVal = 0;
            }
            else {
              cacheForVal = cacheFor.duration();
            }
            JapidRenderer.getCache().put(cacheForKey, cacheForVal);
        }
      }
    }
View Full Code Here


          SimpleResult result = null;
          Request req = ctx.request();
          String method = req.method();
          int duration = 0;
          String key = null;
          Cached cachAnno = actionMethod.getAnnotation(Cached.class);
          // Check the cache (only for GET or HEAD)
          if ((method.equals("GET") || method.equals("HEAD")) && cachAnno != null) {
            key = cachAnno.key();
            if ("".equals(key) || key == null) {
              key = "urlcache:" + req.uri() + ":" + req.queryString();
            }
            duration = cachAnno.duration();
            result = (SimpleResult) Cache.get(key);
          }
          if (result == null) {
            // pass the action name hint to japid controller
            threadData.put(ACTION_METHOD, actionName);
View Full Code Here

TOP

Related Classes of play.cache.Cached

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.