org.exoplatform.settings.cache.selector
Class SettingCacheSelector

java.lang.Object
  extended by org.exoplatform.settings.cache.selector.SettingCacheSelector
All Implemented Interfaces:
org.exoplatform.services.cache.CachedObjectSelector<org.exoplatform.commons.api.settings.data.SettingKey,Object>

public class SettingCacheSelector
extends Object
implements org.exoplatform.services.cache.CachedObjectSelector<org.exoplatform.commons.api.settings.data.SettingKey,Object>

Created by The eXo Platform SAS Author : Nguyen Viet Bang bangnv@exoplatform.com Nov 27, 2012 This class allows to select all setting cache objects which are in a specified Context or Scope. The callback function of this selector is to remove all selected setting object.


Constructor Summary
SettingCacheSelector(org.exoplatform.commons.api.settings.data.SettingContext provider)
          Create a selector with a specified context
 
Method Summary
 void onSelect(org.exoplatform.services.cache.ExoCache<? extends org.exoplatform.commons.api.settings.data.SettingKey,? extends Object> cache, org.exoplatform.commons.api.settings.data.SettingKey key, org.exoplatform.services.cache.ObjectCacheInfo<? extends Object> ocinfo)
          Callback function if select function return true.
 boolean select(org.exoplatform.commons.api.settings.data.SettingKey key, org.exoplatform.services.cache.ObjectCacheInfo<? extends Object> ocinfo)
          This function allows this selector could select right object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SettingCacheSelector

public SettingCacheSelector(org.exoplatform.commons.api.settings.data.SettingContext provider)
Create a selector with a specified context

Parameters:
provider - context or scope with which the specified value is to be associated
Method Detail

select

public boolean select(org.exoplatform.commons.api.settings.data.SettingKey key,
                      org.exoplatform.services.cache.ObjectCacheInfo<? extends Object> ocinfo)
This function allows this selector could select right object.

Specified by:
select in interface org.exoplatform.services.cache.CachedObjectSelector<org.exoplatform.commons.api.settings.data.SettingKey,Object>
Parameters:
key - the key which is composed by context, scope, key
ocinfo - cache info (expire time, cache associated object)
Returns:
return true if compared key is equals to provider, false if not

onSelect

public void onSelect(org.exoplatform.services.cache.ExoCache<? extends org.exoplatform.commons.api.settings.data.SettingKey,? extends Object> cache,
                     org.exoplatform.commons.api.settings.data.SettingKey key,
                     org.exoplatform.services.cache.ObjectCacheInfo<? extends Object> ocinfo)
              throws Exception
Callback function if select function return true. This function will remove this selected setting key from cache.

Specified by:
onSelect in interface org.exoplatform.services.cache.CachedObjectSelector<org.exoplatform.commons.api.settings.data.SettingKey,Object>
Parameters:
cache - ExoCache
key - setting will be removed
cinfo - cache info
Throws:
Exception


Copyright © 2003–2014 eXo Platform SAS. All rights reserved.