001
014
015 package com.liferay.portlet;
016
017 import com.liferay.portal.kernel.cache.MultiVMPoolUtil;
018 import com.liferay.portal.kernel.cache.PortalCache;
019 import com.liferay.portal.kernel.util.StringUtil;
020
021
024 public class PortalPreferencesWrapperCacheUtil {
025
026 public static final String CACHE_NAME =
027 PortalPreferencesWrapperCacheUtil.class.getName();
028
029 public static PortalPreferencesWrapper get(long ownerId, int ownerType) {
030 String cacheKey = StringUtil.toHexString(ownerId).concat(
031 StringUtil.toHexString(ownerType));
032
033 return _portalPreferencesWrapperPortalCache.get(cacheKey);
034 }
035
036 public static void put(
037 long ownerId, int ownerType,
038 PortalPreferencesWrapper portalPreferencesWrapper) {
039
040 String cacheKey = StringUtil.toHexString(ownerId).concat(
041 StringUtil.toHexString(ownerType));
042
043 _portalPreferencesWrapperPortalCache.put(
044 cacheKey, portalPreferencesWrapper);
045 }
046
047 public static void remove(long ownerId, int ownerType) {
048 String cacheKey = StringUtil.toHexString(ownerId).concat(
049 StringUtil.toHexString(ownerType));
050
051 _portalPreferencesWrapperPortalCache.remove(cacheKey);
052 }
053
054 private static PortalCache<String, PortalPreferencesWrapper>
055 _portalPreferencesWrapperPortalCache = MultiVMPoolUtil.getCache(
056 CACHE_NAME);
057
058 }