KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > pets > PetshopCache


1 package org.apache.tapestry.pets;
2
3 import pt.waveweb.util.LruCache;
4
5 public class PetshopCache {
6
7     private static LruCache LRUCache;
8
9     private static final long CACHE_TIMEOUT = 10 * 60 * 1000; // 10 minutes
10

11     private static final long CACHE_LIFESPAN = 20 * 60 * 1000; // 20 minutes
12

13     private static final int CACHE_SIZE = 100;
14
15     public synchronized static LruCache getCacheInstance() {
16         if (LRUCache == null) {
17             LRUCache = new LruCache(CACHE_TIMEOUT, CACHE_LIFESPAN, CACHE_SIZE);
18         }
19
20         return LRUCache;
21     }
22 }
Popular Tags