001
014
015 package com.liferay.portal.velocity;
016
017 import com.liferay.portal.kernel.cache.MultiVMKeyPoolUtil;
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 void clear() {
028 _portalCache.removeAll();
029 }
030
031 public static Resource get(String key) {
032 Object obj = _portalCache.get(key);
033
034 if ((obj != null) && (obj instanceof Resource)) {
035 return (Resource)obj;
036 }
037 else {
038 return null;
039 }
040 }
041
042 public static void put(String key, Resource resource) {
043 _portalCache.put(key, resource);
044 }
045
046 public static void remove(String key) {
047 _portalCache.remove(key);
048 }
049
050 private static PortalCache _portalCache = MultiVMKeyPoolUtil.getCache(
051 LiferayResourceCacheUtil.class.getName());
052
053 }