Examples of Cached


Examples of org.apache.isis.applib.annotation.Cached

    public CachedAnnotationFactory() {
        super(CachedAnnotation.class);
    }

    public Annotation process(final Class clazz) {
        Cached annotation = (Cached) clazz.getAnnotation(Cached.class);
        return create(annotation);
    }
View Full Code Here

Examples of org.apache.tapestry.annotations.Cached

           
      // add a property to store whether or not the method has been called
      String fieldName = transformation.addField(PRIVATE, method.getReturnType(), propertyName);
      String calledField = transformation.addField(PRIVATE, "boolean", fieldName + "$called");
 
      Cached once = transformation.getMethodAnnotation(method, Cached.class);
      String bindingField = null;
      String bindingValueField = null;
      boolean watching = once.watch().length() > 0;
      if (watching) {
        // add fields to store the binding and the value
        bindingField = transformation.addField(PRIVATE, Binding.class.getCanonicalName(), fieldName + "$binding");
        bindingValueField = transformation.addField(PRIVATE, "java.lang.Object", fieldName + "$bindingValue");

        String bindingSourceField = transformation.addInjectedField(BindingSource.class, fieldName + "$bindingsource", _bindingSource);
   
        String body = String.format("%s = %s.newBinding(\"Watch expression\", %s, \"%s\", \"%s\");",
            bindingField,
            bindingSourceField,
            transformation.getResourcesFieldName(),
            TapestryConstants.PROP_BINDING_PREFIX,
            once.watch());
        transformation.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, body);
      }
     
      BodyBuilder b = new BodyBuilder();
View Full Code Here

Examples of org.apache.tapestry5.annotations.Cached

                // Each instance will get a new PerThreadValue
                return perThreadManager.createValue();
            }
        });

        Cached annotation = method.getAnnotation(Cached.class);

        MethodResultCacheFactory factory = createFactory(plasticClass, annotation.watch(), method);

        MethodAdvice advice = createAdvice(cacheField, factory);

        method.addAdvice(advice);
    }
View Full Code Here

Examples of org.apache.tapestry5.annotations.Cached

        // between different instances of the same component within or across pages). This
        // name can't be calculated until page instantiation time.

        FieldAccess fieldAccess = createPerThreadValueField(transformation, method);

        Cached annotation = method.getAnnotation(Cached.class);

        MethodResultCacheFactory factory = createFactory(transformation, annotation.watch(), method);

        ComponentMethodAdvice advice = createAdvice(fieldAccess, factory);

        method.addAdvice(advice);
    }
View Full Code Here

Examples of org.apache.tapestry5.annotations.Cached

                // Each instance will get a new PerThreadValue
                return perThreadManager.createValue();
            }
        });

        Cached annotation = method.getAnnotation(Cached.class);

        MethodResultCacheFactory factory = createFactory(plasticClass, annotation.watch(), method);

        MethodAdvice advice = createAdvice(cacheField, factory);

        method.addAdvice(advice);
    }
View Full Code Here

Examples of org.apache.tapestry5.annotations.Cached

            // add a property to store whether or not the method has been called
            String fieldName = transformation.addField(PRIVATE, method.getReturnType(), propertyName);
            String calledField = transformation.addField(PRIVATE, "boolean", fieldName + "$called");

            Cached once = transformation.getMethodAnnotation(method, Cached.class);
            String bindingField = null;
            String bindingValueField = null;
            boolean watching = once.watch().length() > 0;

            if (watching)
            {
                // add fields to store the binding and the value
                bindingField = transformation.addField(PRIVATE, Binding.class.getCanonicalName(),
                                                       fieldName + "$binding");
                bindingValueField = transformation.addField(PRIVATE, "java.lang.Object", fieldName + "$bindingValue");

                String bindingSourceField = transformation.addInjectedField(BindingSource.class,
                                                                            fieldName + "$bindingsource",
                                                                            bindingSource);

                String body = String.format("%s = %s.newBinding(\"Watch expression\", %s, \"%s\", \"%s\");",
                                            bindingField,
                                            bindingSourceField,
                                            transformation.getResourcesFieldName(),
                                            BindingConstants.PROP,
                                            once.watch());

                transformation.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, body);
            }

            BodyBuilder b = new BodyBuilder();
View Full Code Here

Examples of org.picocontainer.behaviors.Cached

        final ComponentAdapter componentAdapter;
        if (ensureThreadLocal) {
            componentAdapter = new ThreadLocalized(super.createComponentAdapter(
                    componentMonitor, lifecycleStrategy, componentProperties, componentKey, componentImplementation, parameters), proxyFactory);
        } else {
            componentAdapter = new Cached(super.createComponentAdapter(
                    componentMonitor, lifecycleStrategy, componentProperties, componentKey, componentImplementation, parameters), new ThreadLocalReference());
        }
        return componentAdapter;
    }
View Full Code Here

Examples of org.picocontainer.behaviors.Cached

            return componentMonitor.newBehavior(new ThreadLocalized(super.addComponentAdapter(componentMonitor,
                                                                     lifecycleStrategy,
                                                                     componentProperties,
                                                                     adapter), proxyFactory));
        } else {
            return componentMonitor.newBehavior(new Cached(super.addComponentAdapter(componentMonitor,
                                                                 lifecycleStrategy,
                                                                 componentProperties,
                                                                 adapter), new ThreadLocalReference()));
        }
View Full Code Here

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

Examples of play.cache.Cached

          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
Copyright © 2018 www.massapi.com. 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.