Package net.sf.ehcache

Examples of net.sf.ehcache.Element


    }

    public T put( V key, T value )
    {
        // Multiple steps done to satisfy Cache API requirement for Previous object return.
        Element elem = null;
        Object previous = null;
        elem = ehcache.get( key );
        if ( elem != null )
        {
            previous = elem.getObjectValue();
        }
        elem = new Element( key, value );
        ehcache.put( elem );
        return (T) previous;
    }
View Full Code Here


        return (T) previous;
    }

    public T remove( V key )
    {
        Element elem = null;
        Object previous = null;
        elem = ehcache.get( key );
        if ( elem != null )
        {
            previous = elem.getObjectValue();
            ehcache.remove( key );
        }

        return (T) previous;
    }
View Full Code Here

    {
        if (cache != null)
        {
            try
            {
                Element element = cache.get(objectId);
                if (element != null)
                    return (T) element.getValue();
            }
            catch (Exception ex)
            {
                log.error("getFromCache", ex);
            }
View Full Code Here

    {
        if (cache != null)
        {
            try
            {
                cache.put(new Element(objectId, object));
            }
            catch (Exception ex)
            {
                log.error("putToCache", ex);
            }
View Full Code Here

      }
      if ( key == null ) {
        return null;
      }
      else {
        Element element = cache.get( key );
        if ( element == null ) {
          if ( log.isDebugEnabled() ) {
            log.debug( "Element for " + key + " is null" );
          }
          return null;
        }
        else {
          return element.getObjectValue();
        }
      }
    }
    catch (net.sf.ehcache.CacheException e) {
      throw new CacheException( e );
View Full Code Here

   * @throws CacheException if the {@link CacheManager}
   *                        is shutdown or another {@link Exception} occurs.
   */
  public void put(Object key, Object value) throws CacheException {
    try {
      Element element = new Element( key, value );
      cache.put( element );
    }
    catch (IllegalArgumentException e) {
      throw new CacheException( e );
    }
View Full Code Here

      }
      if ( key == null ) {
        return null;
      }
      else {
        Element element = cache.get( key );
        if ( element == null ) {
          if ( log.isDebugEnabled() ) {
            log.debug( "Element for " + key + " is null" );
          }
          return null;
        }
        else {
          return element.getObjectValue();
        }
      }
    }
    catch (net.sf.ehcache.CacheException e) {
      throw new CacheException( e );
View Full Code Here

   * @throws CacheException if the {@link CacheManager}
   *                        is shutdown or another {@link Exception} occurs.
   */
  public void put(Object key, Object value) throws CacheException {
    try {
      Element element = new Element( key, value );
      cache.put( element );
    }
    catch (IllegalArgumentException e) {
      throw new CacheException( e );
    }
View Full Code Here

     */
    @Override
    protected void put0(Entity entity, PresenceStanza presenceStanza)
                                    throws PresenceCachingException {
        // Create EhCache elements to be stored
        Element cacheElement = new Element(entity, presenceStanza);
        Element jidElement = new Element(entity.getBareJID(), presenceStanza);

        presenceCache.put(cacheElement);
        jidPresenceCache.put(jidElement);
    }
View Full Code Here

     * @inheritDoc
     */
    @Override
    protected PresenceStanza get0(Entity entity) throws PresenceCachingException {
        // Get the Element from cache
        Element cacheElement = presenceCache.get(entity);

        // return the value from presence cache
        if(cacheElement != null) {
            return (PresenceStanza)cacheElement.getObjectValue();
        }
        return null;
    }
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.