Examples of ICacheElement


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

   */
  protected final void assertCacheWasFlushed() {
    setUpCacheManager();

    int index = 0;
    ICacheElement cacheElement = getCacheElement(0);
    assertCacheEntryFromCacheIsNull(cacheElement, getCacheElement(index));
  }
View Full Code Here

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

   */
  protected final void assertObjectWasCached(Object expectedCachedObject,
      int keyAndModelIndex) {
    setUpCacheManager();

    ICacheElement cacheElement = getCacheElement(keyAndModelIndex);
    assertEquals(expectedCachedObject, cacheElement.getVal());
  }
View Full Code Here

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

    Serializable newKey = getKey(key, cachingModel);
    Object cachedObject = null;

    try {
      ICacheElement cacheElement = cache.get(newKey);
      if (cacheElement != null) {
        cachedObject = cacheElement.getVal();
      }

    } catch (Exception exception) {
      throw new CacheAccessException(exception);
    }
View Full Code Here

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

    String cacheName = cachingModel.getCacheName();

    CompositeCache cache = getCache(cacheName);

    Serializable newKey = getKey(key, cachingModel);
    ICacheElement newCacheElement = new CacheElement(cache.getCacheName(),
        newKey, obj);

    IElementAttributes elementAttributes = cache.getElementAttributes().copy();
    newCacheElement.setElementAttributes(elementAttributes);

    try {
      cache.update(newCacheElement);

    } catch (Exception exception) {
View Full Code Here

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

    Serializable key = updateCache(entry);

    cachingModel.setGroup(entry.group);
    jcsFacade.onRemoveFromCache(entry.key, cachingModel);

    ICacheElement cacheElement = cache.get(key);
    assertNull(cacheElement);
  }
View Full Code Here

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

      GroupId groupId = new GroupId(CACHE_NAME, group);
      GroupAttrName groupAttrName = new GroupAttrName(groupId, key);
      key = groupAttrName;
    }

    ICacheElement cacheElement = new CacheElement(CACHE_NAME, key,
        cacheEntry.value);
    IElementAttributes attributes = cache.getElementAttributes().copy();
    cacheElement.setElementAttributes(attributes);

    cache.update(cacheElement);
    return key;
  }
View Full Code Here

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

        watch = ( ICacheObserver ) obj;

        p( "subscribing to the server" );

        watch.addCacheListener( "testCache", this );
        ICacheElement cb = new CacheElement( "testCache", "testKey", "testVal" );

        for ( int i = 0; i < count; i++ )
        {
            cb = new CacheElement( "testCache", "" + i, "" + i );

            if ( delete )
            {
                p( "deleting a cache item from the server " + i );

                cache.remove( cb.getCacheName(), cb.getKey() );
            }
            if ( write )
            {
                p( "putting a cache bean to the server " + i );

                try
                {
                    cache.update( cb );
                }
                catch ( ObjectExistsException oee )
                {
                    p( oee.toString() );
                }
            }
            if ( read )
            {
                try
                {
                    Object val = cache.get( cb.getCacheName(), cb.getKey() );
                    p( "get " + cb.getKey() + " returns " + val );
                }
                catch ( ObjectNotFoundException onfe )
                {
                }
            }
View Full Code Here

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

        Arrays.sort( keys );

        LinkedList records = new LinkedList();

        ICacheElement element;
        IElementAttributes attributes;
        CacheElementInfo elementInfo;

        DateFormat format = DateFormat.getDateTimeInstance( DateFormat.SHORT,
                                                            DateFormat.SHORT );

        long now = System.currentTimeMillis();

        for ( int i = 0; i < keys.length; i++ )
        {
            element =
                cache.getMemoryCache().getQuiet( (Serializable) keys[ i ] );

            attributes = element.getElementAttributes();

            elementInfo = new CacheElementInfo();

            elementInfo.key = String.valueOf( keys[ i ] );
            elementInfo.eternal = attributes.getIsEternal();
View Full Code Here

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

        CountingOnlyOutputStream counter = new CountingOnlyOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( counter );

        while ( iter.hasNext() )
        {
            ICacheElement ce = (ICacheElement)
                ( ( Map.Entry ) iter.next() ).getValue();

            out.writeObject( ce.getVal() );
        }

        // 4 bytes lost for the serialization header

        return counter.getCount() - 4;
View Full Code Here

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

        // Add items to cache

        for ( int i = 0; i < items; i++ )
        {
            ICacheElement ice = new CacheElement(
                cache.getCacheName(), i + ":key", region + " data " + i);
            ice.setElementAttributes(cache.getElementAttributes().copy());
            lru.update(ice);
        }

        // Test that initial items have been purged
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.