Examples of ICache


Examples of com.jfinal.plugin.activerecord.cache.ICache

   * @param cacheName the cache name
   * @param key the key used to get date from cache
   * @return the list of Model
   */
  public List<M> findByCache(String cacheName, Object key, String sql, Object... paras) {
    ICache cache = DbKit.getCache();
    List<M> result = cache.get(cacheName, key);
    if (result == null) {
      result = find(sql, paras);
      cache.put(cacheName, key, result);
    }
    return result;
  }
View Full Code Here

Examples of com.jfinal.plugin.activerecord.cache.ICache

   * @param cacheName the cache name
   * @param key the key used to get date from cache
   * @return Page
   */
  public Page<M> paginateByCache(String cacheName, Object key, int pageNumber, int pageSize, String select, String sqlExceptSelect, Object... paras) {
    ICache cache = DbKit.getCache();
    Page<M> result = cache.get(cacheName, key);
    if (result == null) {
      result = paginate(pageNumber, pageSize, select, sqlExceptSelect, paras);
      cache.put(cacheName, key, result);
    }
    return result;
  }
View Full Code Here

Examples of com.jfinal.plugin.activerecord.cache.ICache

   * @param cacheName the cache name
   * @param key the key used to get date from cache
   * @return the list of Record
   */
  public static List<Record> findByCache(String cacheName, Object key, String sql, Object... paras) {
    ICache cache = DbKit.getCache();
    List<Record> result = cache.get(cacheName, key);
    if (result == null) {
      result = find(sql, paras);
      cache.put(cacheName, key, result);
    }
    return result;
  }
View Full Code Here

Examples of com.jfinal.plugin.activerecord.cache.ICache

   * Paginate by cache.
   * @see #paginate(int, int, String, String, Object...)
   * @return Page
   */
  public static Page<Record> paginateByCache(String cacheName, Object key, int pageNumber, int pageSize, String select, String sqlExceptSelect, Object... paras) {
    ICache cache = DbKit.getCache();
    Page<Record> result = cache.get(cacheName, key);
    if (result == null) {
      result = paginate(pageNumber, pageSize, select, sqlExceptSelect, paras);
      cache.put(cacheName, key, result);
    }
    return result;
  }
View Full Code Here

Examples of org.apache.drill.exec.cache.infinispan.ICache

  public static RemoteServiceSet getLocalServiceSet(){
    return new RemoteServiceSet(new LocalCache(), new LocalClusterCoordinator());
  }

  public static RemoteServiceSet getServiceSetWithFullCache(DrillConfig config, BufferAllocator allocator) throws Exception{
    ICache c = new ICache(config, allocator, true);
    return new RemoteServiceSet(c, new LocalClusterCoordinator());
  }
View Full Code Here

Examples of org.apache.jcs.engine.behavior.ICache

        if ( log.isDebugEnabled() )
        {
            log.debug( "handleRemoveAll> cacheName=" + cacheName );
        }
        getCacheManager();
        ICache cache = cacheMgr.getCache( cacheName );
        cache.removeAll();
    }
View Full Code Here

Examples of org.apache.jcs.engine.behavior.ICache

    /** Description of the Method */
    public void freeCache( String name )
        throws IOException
    {
        ICache c = null;

        synchronized ( caches )
        {
            c = ( ICache ) caches.get( name );
        }
        if ( c != null )
        {
            c.dispose();
        }
    }
View Full Code Here

Examples of org.apache.jcs.engine.behavior.ICache

        synchronized ( caches )
        {
            Iterator allCaches = caches.values().iterator();
            while ( allCaches.hasNext() )
            {
                ICache c = ( ICache ) allCaches.next();
                if ( c != null )
                {
                    try
                    {
                        c.dispose();
                    }
                    catch ( IOException ex )
                    {
                        log.error( ex );
                    }
View Full Code Here

Examples of org.apache.jcs.engine.behavior.ICache

            }
        }

        for ( int i = 0; i < auxCaches.length; i++ )
        {
            ICache aux = auxCaches[i];

            if ( log.isDebugEnabled() )
            {
                log.debug( "Auxilliary cache type: " + aux.getCacheType() );
            }

            // SEND TO REMOTE STORE
            if ( aux != null && aux.getCacheType() == ICache.REMOTE_CACHE )
            {
                if ( log.isDebugEnabled() )
                {
                    log.debug( "ce.getElementAttributes().getIsRemote() = "
                         + ce.getElementAttributes().getIsRemote() );
                }

                if ( ce.getElementAttributes().getIsRemote()
                     && ! localOnly )
                {
                    try
                    {
                        // need to make sure the group cache understands that the
                        // key is a group attribute on update
                        aux.update( ce );
                        if ( log.isDebugEnabled() )
                        {
                            log.debug( "Updated remote store for "
                                 + ce.getKey() + ce );
                        }
                    }
                    catch ( IOException ex )
                    {
                        log.error( "Failure in updateExclude", ex );
                    }
                }
                // SEND LATERALLY
            }
            else if ( aux != null
                 && aux.getCacheType() == ICache.LATERAL_CACHE )
            {
                // lateral can't do the checking since it is dependent on the cache region
                // restrictions
                if ( log.isDebugEnabled() )
                {
                    log.debug( "lateralcache in aux list: cattr " +
                        cacheAttr.getUseLateral() );
                }
                if ( cacheAttr.getUseLateral()
                     && ce.getElementAttributes().getIsLateral()
                     && ! localOnly )
                {
                    // later if we want a multicast, possibly delete abnormal broadcaster
                    // DISTRIBUTE LATERALLY
                    // Currently always multicast even if the value is unchanged,
                    // just to cause the cache item to move to the front.
                    aux.update( ce );
                    if ( log.isDebugEnabled() )
                    {
                        log.debug( "updated lateral cache for " + ce.getKey() );
                    }
                }
            }
            else if ( aux != null && aux.getCacheType() == ICache.DISK_CACHE )
            {
                // do nothing, the memory manager will call spool where necesary
                // TODO: add option to put all element on disk
            }
        }
View Full Code Here

Examples of org.apache.jcs.engine.behavior.ICache

        boolean diskAvailable = false;

        // SPOOL TO DISK.
        for ( int i = 0; i < auxCaches.length; i++ )
        {
            ICache aux = auxCaches[i];

            if ( aux != null && aux.getCacheType() == ICache.DISK_CACHE )
            {

                diskAvailable = true;

                // write the last item to disk.2
                try
                {
                    // handle event, might move to a new method
                    ArrayList eventHandlers = ce.getElementAttributes().getElementEventHandlers();
                    if ( eventHandlers != null )
                    {
                        if ( log.isDebugEnabled() )
                        {
                            log.debug( "Handlers are registered.  Event -- ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE" );
                        }
                        IElementEvent event = new ElementEvent( ce, IElementEventConstants.ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE );
                        Iterator hIt = eventHandlers.iterator();
                        while ( hIt.hasNext() )
                        {
                            IElementEventHandler hand = ( IElementEventHandler ) hIt.next();
                            //hand.handleElementEvent( event );
                            addElementEvent( hand, event );
                        }
                    }

                    aux.update( ce );
                }
                catch ( IOException ex )
                {
                    // impossible case.
                    ex.printStackTrace();
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.