Examples of Cacheable


Examples of javax.persistence.Cacheable

    Cache cacheAnn = clazzToProcess.getAnnotation( Cache.class );
    if ( cacheAnn != null ) {
      return cacheAnn;
    }

    Cacheable cacheableAnn = clazzToProcess.getAnnotation( Cacheable.class );
    SharedCacheMode mode = determineSharedCacheMode( mappings );
    switch ( mode ) {
      case ALL: {
        cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
        break;
      }
      case ENABLE_SELECTIVE: {
        if ( cacheableAnn != null && cacheableAnn.value() ) {
          cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
        }
        break;
      }
      case DISABLE_SELECTIVE: {
        if ( cacheableAnn == null || cacheableAnn.value() ) {
          cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
        }
        break;
      }
      default: {
View Full Code Here

Examples of loxia.support.cache.annotation.Cacheable

  @Around("@annotation(loxia.support.cache.annotation.Cacheable)")
  public Object doGet(ProceedingJoinPoint pjp) throws Throwable{
    Method m = getMethod(pjp, Cacheable.class);
    Map<String, Object> params = getParams(m, pjp.getArgs());
    Cacheable c = m.getAnnotation(Cacheable.class);
    String methodName = c.value().equals("") ? EncodeUtil.intToBase62(m.getDeclaringClass().getSimpleName().hashCode()) + "."
        + EncodeUtil.intToBase62(m.getName().hashCode()) : c.value();
    /*
     * String methodName = c.value().equals("") ? m.getDeclaringClass().getSimpleName() + "." + m.getName() : c.value();
     */
    String cacheKey = getCacheKey(methodName, params);
    logger.debug("get cache with key: {}", cacheKey);
    Object value = cacheClient.get(cacheKey);
    if (value != null){
      if (value instanceof NullObject)
        value = null;
      logger.debug("Cached value: {} will be returned as type {} with key [{}]", new Object[] { value, m.getReturnType(), cacheKey });
      return value;
    }else{
      value = pjp.proceed(pjp.getArgs());
      cacheValue(methodName, c.cacheKey(), cacheKey, value == null ? NULL : value, c.expire(), params);
      return value;
    }
  }
View Full Code Here

Examples of net.sf.jportlet.service.cache.Cacheable

        CacheDescriptor     cache = _descriptor.getCacheDescriptor( request.getMode(  ) );
        String              id = getCacheableId( cache, request, response );
        PortletResponseImpl response2 = new PortletResponseImpl( this, request, response.getHttpResponse(  ) );
        String              body = null;
        CacheRegion         region = null;
        Cacheable           cacheable;

        /* Load the body from the cache */
        if ( id != null )
        {
            if ( debug )
            {
                _log.debug( "Loading portlet body from the cache.id=" + id );
            }

            region    = getCacheRegion(  );
            cacheable = region.get( id );
            if ( cacheable != null )
            {
                if ( !isDirty( request ) )
                {
                    if ( debug )
                    {
                        _log.debug( "...Portlet body found in the cache" );
                    }

                    body = ( String ) cacheable.getData(  );
                }
                else
                {
                    if ( debug )
                    {
                        _log.debug( "...Portlet dirty. expiring the portlet body" );
                    }

                    cacheable.expire(  );
                    body = null;
                }
            }
        }
        else
View Full Code Here

Examples of net.sf.jportlet.service.cache.Cacheable

        if ( id != null )
        {
            /* Get the cacheable object */
            CacheRegion region = getCacheService( proxy ).getRegion( proxy.getDescriptor(  ).getName(  ), true );
            Cacheable   cacheable = region.get( id );
            if ( cacheable != null )
            {
                if ( !proxy.isDirty( request ) )
                {
                    if ( debug )
                    {
                        __log.debug( "...writing cached content into the portlet response" );
                    }

                    Object              data = cacheable.getData(  );
                    PortletResponseImpl resp = ( PortletResponseImpl ) response;
                    resp.getBuffer(  ).append( data );
                    return Interceptor.SKIP;
                }
                else
                {
                    if ( debug )
                    {
                        __log.debug( "...portlet dirty. expiring the portlet content" );
                    }

                    cacheable.expire(  );
                }
            }
        }

        return Interceptor.CONTINUE;
View Full Code Here

Examples of org.apache.derby.iapi.services.cache.Cacheable

   */
  private void removePermEntryInCache(PermissionsDescriptor perm)
    throws StandardException
  {
    // Remove cached permissions entry if present
    Cacheable cacheEntry = getPermissionsCache().findCached( perm);
    if (cacheEntry != null)
      getPermissionsCache().remove(cacheEntry);
  }
View Full Code Here

Examples of org.apache.derby.iapi.services.cache.Cacheable

  }

    private Object getPermissions( PermissionsDescriptor key) throws StandardException
    {
        // RESOLVE get a READ COMMITTED (shared) lock on the permission row
        Cacheable entry = getPermissionsCache().find( key);
        if( entry == null)
            return null;
        Object perms = entry.getIdentity();
        getPermissionsCache().release( entry);
        return perms;
    }
View Full Code Here

Examples of org.apache.derby.iapi.services.cache.Cacheable

            getLanguageConnectionFactory().getStatementCache();

    if (statementCache == null)
      return;
      Cacheable cachedItem = statementCache.findCached(statement);
      if (cachedItem != null)
        statementCache.remove(cachedItem);
  }
View Full Code Here

Examples of org.apache.derby.iapi.services.cache.Cacheable

    // statement caching disable when in DDL mode
    if (dataDictionaryInWriteMode()) {
      return null;
    }

    Cacheable cachedItem = statementCache.find(statement);

    CachedStatement cs = (CachedStatement) cachedItem;


    GenericPreparedStatement ps = cs.getPreparedStatement();
View Full Code Here

Examples of org.apache.derby.iapi.services.cache.Cacheable

           
            Object[] removeInfo =
                            (Object[]) droppedTableStubInfo.get(logInstant);
            Object identity = removeInfo[1];
            //delete the entry in the container cache.
            Cacheable ccentry =  containerCache.findCached(identity);
            if(ccentry!=null)
              containerCache.remove(ccentry);

            //delete the stub we don't require it during recovery
                        synchronized( this)
View Full Code Here

Examples of org.apache.derby.iapi.services.cache.Cacheable

        }
    }

  public Cacheable createIdentity( Object key, Object createParameter ) throws StandardException
  {
        Cacheable cacheable = this;

        //
        // The createParameter arg is unused.
        //
        return cacheable.setIdentity( key );
  }
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.