Package com.spaceprogram.simplejpa.cache

Examples of com.spaceprogram.simplejpa.cache.Cache


    public <T> T cacheGet(Class<T> aClass, Object id) {
        String key = cacheKey(aClass, id);
        logger.finest("getting item from cache with cachekey=" + key);
        T o = sessionCache != null ? (T) sessionCache.get(key) : null;
        if (o == null) {
            Cache c = getFactory().getCache(aClass);
            if (c != null) {
                o = (T) c.getObj(id);
                if (o != null) {
                    logger.finest("Got item from second level cache!");
                    replaceEntityManager(o, this);
                }
            }
View Full Code Here


    public void cachePut(Object id, Object newInstance) {
        String key = cacheKey(newInstance.getClass(), id);
        logger.finest("putting item in cache with cachekey=" + key + " - " + newInstance);
        if (sessionCache != null)
            sessionCache.put(key, newInstance);
        Cache c = getFactory().getCache(newInstance.getClass());
        if (c != null) {
            c.put(id, newInstance);
        }
    }
View Full Code Here

    public Object cacheRemove(Class aClass, String id) {
        String key = cacheKey(aClass, id);
        logger.finest("removing item from cache with cachekey=" + key);
        Object o = sessionCache != null ? sessionCache.remove(key) : null;
        Cache c = getFactory().getCache(aClass);
        if (c != null) {
            Object o2 = c.remove(id);
            if (o == null)
                o = o2;
        }
        logger.finest("removed object from cache=" + o);
        return o;
View Full Code Here

    public <T> T cacheGet(Class<T> aClass, Object id) {
        String key = cacheKey(aClass, id);
        logger.finest("getting item from cache with cachekey=" + key);
        T o = sessionCache != null ? (T) sessionCache.get(key) : null;
        if (o == null) {
            Cache c = getFactory().getCache(aClass);
            if (c != null) {
                o = (T) c.getObj(id);
                if (o != null) {
                    logger.finest("Got item from second level cache!");
                    replaceEntityManager(o, this);
                }
            }
View Full Code Here

    public void cachePut(Object id, Object newInstance) {
        String key = cacheKey(newInstance.getClass(), id);
        logger.finest("putting item in cache with cachekey=" + key + " - " + newInstance);
        if (sessionCache != null)
            sessionCache.put(key, newInstance);
        Cache c = getFactory().getCache(newInstance.getClass());
        if (c != null) {
            c.put(id, newInstance);
        }
    }
View Full Code Here

    public Object cacheRemove(Class aClass, String id) {
        String key = cacheKey(aClass, id);
        logger.finest("removing item from cache with cachekey=" + key);
        Object o = sessionCache != null ? sessionCache.remove(key) : null;
        Cache c = getFactory().getCache(aClass);
        if (c != null) {
            Object o2 = c.remove(id);
            if (o == null)
                o = o2;
        }
        logger.finest("removed object from cache=" + o);
        return o;
View Full Code Here

    public <T> T cacheGet(Class<T> aClass, Object id) {
        String key = cacheKey(aClass, id);
        logger.finest("getting item from cache with cachekey=" + key);
        T o = sessionCache != null ? (T) sessionCache.get(key) : null;
        if (o == null) {
            Cache c = getFactory().getCache(aClass);
            if (c != null) {
                o = (T) c.getObj(id);
                if (o != null) {
                    logger.finest("Got item from second level cache!");
                    replaceEntityManager(o, this);
                }
            }
View Full Code Here

    public void cachePut(Object id, Object newInstance) {
        String key = cacheKey(newInstance.getClass(), id);
        logger.finest("putting item in cache with cachekey=" + key + " - " + newInstance);
        if (sessionCache != null)
            sessionCache.put(key, newInstance);
        Cache c = getFactory().getCache(newInstance.getClass());
        if (c != null) {
            c.put(id, newInstance);
        }
    }
View Full Code Here

    public Object cacheRemove(Class aClass, String id) {
        String key = cacheKey(aClass, id);
        logger.finest("removing item from cache with cachekey=" + key);
        Object o = sessionCache != null ? sessionCache.remove(key) : null;
        Cache c = getFactory().getCache(aClass);
        if (c != null) {
            Object o2 = c.remove(id);
            if (o == null)
                o = o2;
        }
        logger.finest("removed object from cache=" + o);
        return o;
View Full Code Here

TOP

Related Classes of com.spaceprogram.simplejpa.cache.Cache

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.