Package net.sf.ehcache

Examples of net.sf.ehcache.Element


    @SuppressWarnings("unchecked")
    @ManagedOperation()
    @Override
    public Map<String, String> get(String user, String realm) {
        Element element = cache.get(user + "@" + realm);
        if (element != null && !cache.isExpired(element)) {
            return (Map<String, String>)element.getObjectValue();
        }
        return null;
    }
View Full Code Here


   * {@inherit-doc}
   *
   * @see org.apache.sling.commons.cache.api.Cache#get(java.lang.String)
   */
  public V get(String key) {
    Element e = cache.get(key);
    if (e == null) {
      return stats(null);
    }
    return stats(e.getObjectValue());
  }
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public V put(String key, V payload) {
    V previous = null;
    if (cache.isKeyInCache(key)) {
      Element e = cache.get(key);
      if (e != null) {
        previous = (V) e.getObjectValue();
      }
    }
    cache.put(new Element(key, payload));
    return previous;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public Collection<V> values() {
    List<String> keys = cache.getKeys();
    List<V> values = new ArrayList<V>();
    for (String k : keys) {
      Element e = cache.get(k);
      if (e != null) {
        values.add((V) e.getObjectValue());
      }
    }
    return values;
  }
View Full Code Here

  }

  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    final Cache<SerializableEntityKey> entityCache = datastoreProvider.getEntityCache();
    final Element element = entityCache.get( new SerializableEntityKey( key ) );
    if ( element != null ) {
      return createTuple( element );
    }
    else {
      return null;
View Full Code Here

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    final Cache<SerializableEntityKey> entityCache = datastoreProvider.getEntityCache();
    final HashMap<String, Object> tuple = new HashMap<String, Object>();
    entityCache.put( new Element( new SerializableEntityKey( key ), tuple ) );

    return new Tuple( new MapTupleSnapshot( tuple ) );
  }
View Full Code Here

  public void insertOrUpdateTuple(EntityKey key, Tuple tuple, TupleContext tupleContext) {
    Map<String, Object> entityRecord = ( (MapTupleSnapshot) tuple.getSnapshot() ).getMap();
    MapHelpers.applyTupleOpsOnMap( tuple, entityRecord );

    final Cache<SerializableEntityKey> entityCache = datastoreProvider.getEntityCache();
    entityCache.put( new Element( new SerializableEntityKey( key ), entityRecord ) );
  }
View Full Code Here

  }

  @Override
  public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
    final Cache<SerializableAssociationKey> associationCache = datastoreProvider.getAssociationCache();
    final Element element = associationCache.get( new SerializableAssociationKey( key ) );

    if ( element == null ) {
      return null;
    }
    else {
      @SuppressWarnings("unchecked")
      Map<SerializableRowKey, Map<String, Object>> associationRows = (Map<SerializableRowKey, Map<String, Object>>) element.getObjectValue();
      return new Association( new SerializableMapAssociationSnapshot( associationRows ) );
    }
  }
View Full Code Here

  @Override
  public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
    final Cache<SerializableAssociationKey> associationCache = datastoreProvider.getAssociationCache();
    Map<SerializableRowKey, Map<String, Object>> association = new HashMap<SerializableRowKey, Map<String, Object>>();
    associationCache.put( new Element( new SerializableAssociationKey( key ), association ) );
    return new Association( new SerializableMapAssociationSnapshot( association ) );
  }
View Full Code Here

          break;
      }
    }

    final Cache<SerializableAssociationKey> associationCache = datastoreProvider.getAssociationCache();
    associationCache.put( new Element( new SerializableAssociationKey( key ), associationRows ) );
  }
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.