Package org.apache.jcs

Examples of org.apache.jcs.JCS


        System.getProperties().setProperty( "MY_SYSTEM_PROPERTY_DISK_DIR", "system_set" );

        CompositeCacheManager mgr = CompositeCacheManager.getUnconfiguredInstance();
        mgr.configure( "/TestSystemProperties.ccf" );

        JCS cache = JCS.getInstance( "missing" );
        // TODO check against the actual default def
        assertEquals( "We should have used the default property for the memory size", 100, cache.getCacheAttributes()
            .getMaxObjects() );

    }
View Full Code Here


    }
   
    public MetsObject getMetsObject(String oid, boolean forceUpdate)
            throws DAOException {
        MetsObject navObj = null;
        JCS navObjCache = null;
        try {
            navObjCache = JCS.getInstance(Globals.METSOBJ_CACHE);
            navObj = (MetsObject)navObjCache.get(Globals.METSOBJ_CACHE_KEY + oid);
        } catch (CacheException cex) {
            log.error("Corrupted Cache[" + Globals.METSOBJ_CACHE
                + "]: " + cex.getMessage());
            log.error(new ExceptionBean(cex).getStack());
        }
        if (navObj == null || forceUpdate ||
                navObj.getTimestamp() < child.getConfig().getDataSource().getTimestamp(oid)) {
            navObj = child.getMetsObject(oid);
            if (navObjCache != null) {
                try {
                    navObjCache.put(Globals.METSOBJ_CACHE_KEY + oid, navObj);
                } catch (CacheException cex) {
                    log.error("Corrupted Cache[" + Globals.METSOBJ_CACHE
                        + "]: " + cex.getMessage());
                    log.error(new ExceptionBean(cex).getStack());
                }
View Full Code Here

            return -1;
    }

    public JSONObject getJSONObject(String oid, boolean forceUpdate) throws DAOException {
        JSONObject navObj = null;
        JCS navObjCache = null;
        try {
            navObjCache = JCS.getInstance(Globals.METSOBJ_CACHE);
            navObj = (JSONObject)navObjCache.get(Globals.METSOBJ_CACHE_KEY + oid);
        } catch (CacheException cex) {
            log.error("Corrupted Cache[" + Globals.METSOBJ_CACHE
                + "]: " + cex.getMessage());
            log.error(new ExceptionBean(cex).getStack());
        }
        if (navObj == null || forceUpdate ||
                parseTime((String)navObj.get("timestamp")) < child.getConfig().getDataSource().getTimestamp(oid)) {
            navObj = child.getJSONObject(oid);
            if (navObjCache != null) {
                try {
                    navObjCache.put(Globals.METSOBJ_CACHE_KEY + oid, navObj);
                } catch (CacheException cex) {
                    log.error("Corrupted Cache[" + Globals.METSOBJ_CACHE
                        + "]: " + cex.getMessage());
                    log.error(new ExceptionBean(cex).getStack());
                }
View Full Code Here

     * @param regionName     Name of cache region
     * @return JCS    A cache region.
     */

    public static JCS initCacheRegion(String configFilePath, String regionName) throws CacheException {
        JCS cache = null;
        // Set the config file
        try {
            if (configFilePath != null)
                JCS.setConfigFilename(configFilePath);
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.jcs.JCS

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.