1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.dao.orm.hibernate;
16  
17  import com.liferay.portal.kernel.util.GetterUtil;
18  import com.liferay.portal.util.PropsUtil;
19  
20  import com.opensymphony.oscache.base.CacheEntry;
21  
22  import java.util.Properties;
23  
24  import org.hibernate.cache.Cache;
25  import org.hibernate.cache.CacheException;
26  import org.hibernate.cache.CacheProvider;
27  import org.hibernate.cache.Timestamper;
28  import org.hibernate.util.StringHelper;
29  
30  /**
31   * <a href="OSCacheProvider.java.html"><b><i>View Source</i></b></a>
32   *
33   * @author     Mathias Bogaert
34   * @author     Brian Wing Shun Chan
35   * @deprecated
36   */
37  public class OSCacheProvider implements CacheProvider {
38  
39      public static final String OSCACHE_REFRESH_PERIOD = "refresh.period";
40  
41      public static final String OSCACHE_CRON = "cron";
42  
43      public Cache buildCache(String region, Properties properties)
44          throws CacheException {
45  
46          int refreshPeriod = GetterUtil.getInteger(
47              PropsUtil.get(StringHelper.qualify(region, OSCACHE_REFRESH_PERIOD)),
48              CacheEntry.INDEFINITE_EXPIRY);
49  
50          String cron = PropsUtil.get(StringHelper.qualify(region, OSCACHE_CRON));
51  
52          return new CacheWrapper(new OSCache(refreshPeriod, cron, region));
53      }
54  
55      public boolean isMinimalPutsEnabledByDefault() {
56          return false;
57      }
58  
59      public long nextTimestamp() {
60          return Timestamper.next();
61      }
62  
63      public void start(Properties properties) throws CacheException {
64      }
65  
66      public void stop() {
67      }
68  
69  }