Package KFM

Examples of KFM.Cache


    {
        // *** Slightly adapted Cut&Paste from testAdd() BEGIN
        int tCacheMaxSize = 100000; // bytes
        int tCacheMaxLifetime = -1; // never expire
        emptyCacheDir();
        Cache tMemoryCache = new Cache(tCacheMaxSize, tCacheMaxLifetime);

        // write html to cache
        String tCacheKey = "cachedfile.html";
        String tHTML = "<html>very short HTML</html>";
        Cacheable tCacheItem = new CachedHTMLItem(tHTML, tCacheKey);
        tMemoryCache.add(tCacheKey, tCacheItem);

        // get html from cache
        tCacheItem = tMemoryCache.get(tCacheKey);
        String tCachedContent = ((CachedHTMLItem) tCacheItem).getHTML().trim();
        assertTrue("Could not retrieve cashed item: " + tCacheKey, tCacheItem != null);
        assertTrue("Cached item doen't contain expected content: " + tCachedContent, tCachedContent.equals(tHTML));
        // *** Slightly adapted Cut&Paste from testAdd() END
    }
View Full Code Here

TOP

Related Classes of KFM.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.