KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > whirlycott > cache > hibernate > WhirlycacheProvider


1 /*
2  * Created on Dec 19, 2004 by pjacob
3  *
4  */

5 package com.whirlycott.cache.hibernate;
6
7 import java.util.Properties JavaDoc;
8
9 import org.apache.commons.logging.Log;
10 import org.apache.commons.logging.LogFactory;
11
12 import com.whirlycott.cache.Messages;
13
14 import net.sf.hibernate.cache.Cache;
15 import net.sf.hibernate.cache.CacheException;
16 import net.sf.hibernate.cache.CacheProvider;
17 import net.sf.hibernate.cache.Timestamper;
18
19 /**
20  * @author pjacob
21  *
22  */

23 public class WhirlycacheProvider implements CacheProvider {
24
25     /**
26      * Logger.
27      */

28     private static final Log log = LogFactory.getLog(WhirlycacheProvider.class);
29
30     /*
31      * (non-Javadoc)
32      *
33      * @see net.sf.hibernate.cache.CacheProvider#buildCache(java.lang.String,
34      * java.util.Properties)
35      */

36     public Cache buildCache(final String JavaDoc _name, final Properties JavaDoc _props) throws CacheException {
37         log.debug(Messages.getString("WhirlycacheProvider.building_cache") + _name); //$NON-NLS-1$
38
return new WhirlycachePlugin(_name);
39     }
40
41     /*
42      * (non-Javadoc)
43      *
44      * @see net.sf.hibernate.cache.CacheProvider#nextTimestamp()
45      */

46     public long nextTimestamp() {
47         return Timestamper.next();
48     }
49
50 }
51
52
Popular Tags