001
014
015 package com.liferay.portal.velocity;
016
017 import com.liferay.portal.kernel.cache.MultiVMPoolUtil;
018 import com.liferay.portal.kernel.cache.PortalCache;
019
020 import org.apache.velocity.runtime.resource.Resource;
021
022
025 public class LiferayResourceCacheUtil {
026
027 public static final String CACHE_NAME =
028 LiferayResourceCacheUtil.class.getName();
029
030 public static void clear() {
031 _portalCache.removeAll();
032 }
033
034 public static Resource get(String key) {
035 Object resource = _portalCache.get(key);
036
037 if ((resource != null) && (resource instanceof Resource)) {
038 return (Resource)resource;
039 }
040
041 return null;
042 }
043
044 public static void put(String key, Resource resource) {
045 _portalCache.put(key, resource);
046 }
047
048 public static void remove(String key) {
049 _portalCache.remove(key);
050 }
051
052 private static PortalCache _portalCache = MultiVMPoolUtil.getCache(
053 CACHE_NAME);
054
055 }