Package net.sf.ehcache

Examples of net.sf.ehcache.Element


    Method put = Cache.class.getMethod("put", new Class[]{Element.class});
    setUpCacheAsMockObject(put);

    IllegalStateException expected = new IllegalStateException();
    String objectToCache = "Luke";
    Element element = new Element(KEY, objectToCache);

    cache.put(element);
    cacheControl.setMatcher(new ElementMatcher());
    cacheControl.setThrowable(expected);
    cacheControl.replay();
View Full Code Here


    }
  }

  public void testOnRemoveFromCache() throws Exception {
    setUpCache();
    cache.put(new Element(KEY, "An Object"));
    cacheFacade.onRemoveFromCache(KEY, cachingModel);

    assertNull("The element with key '" + KEY
        + "' should have been removed from the cache", cache.get(KEY));
  }
View Full Code Here

    cacheControl.verify();
  }

  public void testOnRemoveFromCacheWhenCacheIsNotFound() throws Exception {
    setUpCache();
    cache.put(new Element(KEY, "An Object"));
    cachingModel.setCacheName("NonExistingCache");
    try {
      cacheFacade.onRemoveFromCache(KEY, cachingModel);
      fail();
View Full Code Here

      throws CacheException {
    Ehcache cache = getCache(model);
    Object cachedObject = null;

    try {
      Element cacheElement = cache.get(key);
      if (cacheElement != null) {
        cachedObject = cacheElement.getValue();
      }

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

   *Object)
   */
  protected void onPutInCache(Serializable key, CachingModel model, Object obj)
      throws CacheException {
    Ehcache cache = getCache(model);
    Element newCacheElement = new Element(key, (Serializable) obj);

    try {
      cache.put(newCacheElement);

    } catch (Exception exception) {
View Full Code Here

                if ( entry instanceof ClonedServerEntry )
                {
                    entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
                }

                entryCache.replace( new Element( id, entry ) );
            }
            else if ( ( opCtx instanceof MoveOperationContext ) ||
                ( opCtx instanceof MoveAndRenameOperationContext ) ||
                ( opCtx instanceof RenameOperationContext ) )
            {
View Full Code Here

        if ( entryCache == null )
        {
            return null;
        }

        Element el = entryCache.get( id );

        if ( el != null )
        {
            return ( Entry ) el.getValue();
        }

        return null;
    }
View Full Code Here

        if ( entry instanceof ClonedServerEntry )
        {
            entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
        }

        entryCache.put( new Element( id, entry ) );
    }
View Full Code Here

            {
                ParentIdAndRdn cur = null;
           
                if ( piarCache != null )
                {
                    Element piar = piarCache.get( parentId );
                   
                    if ( piar != null )
                    {
                        cur = (ParentIdAndRdn)piar.getValue();
                    }
                    else
                    {
                        cur = rdnIdx.reverseLookup( parentId );
                       
                        if ( cur == null )
                        {
                            return null;
                        }
                       
                        piarCache.put( new Element( parentId, cur) );
                    }
                }
                else
                {
                    cur = rdnIdx.reverseLookup( parentId );
View Full Code Here

        // Add the alias to the simple alias index
        aliasIdx.add( aliasTarget, aliasId );
       
        if ( aliasCache != null )
        {
            aliasCache.putnew Element( aliasId, aliasTarget ) );
        }

        /*
         * Handle One Level Scope Alias Index
         *
 
View Full Code Here

TOP

Related Classes of net.sf.ehcache.Element

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.