public NearCacheConfig(int timeToLiveSeconds, int maxSize, string evictionPolicy, int maxIdleSeconds, bool invalidateOnChange, InMemoryFormat inMemoryFormat)
 {
     this.timeToLiveSeconds = timeToLiveSeconds;
     this.maxSize = maxSize;
     this.evictionPolicy = evictionPolicy;
     this.maxIdleSeconds = maxIdleSeconds;
     this.invalidateOnChange = invalidateOnChange;
     this.inMemoryFormat = inMemoryFormat;
 }
Exemple #2
0
 public NearCacheConfig(int timeToLiveSeconds, int maxSize, string evictionPolicy, int maxIdleSeconds, bool invalidateOnChange, InMemoryFormat inMemoryFormat)
 {
     this.timeToLiveSeconds  = timeToLiveSeconds;
     this.maxSize            = maxSize;
     this.evictionPolicy     = evictionPolicy;
     this.maxIdleSeconds     = maxIdleSeconds;
     this.invalidateOnChange = invalidateOnChange;
     this.inMemoryFormat     = inMemoryFormat;
 }
 public NearCacheConfig(NearCacheConfig config)
 {
     _name               = config.GetName();
     _evictionPolicy     = config.GetEvictionPolicy();
     _inMemoryFormat     = config.GetInMemoryFormat();
     _invalidateOnChange = config.IsInvalidateOnChange();
     _maxIdleSeconds     = config.GetMaxIdleSeconds();
     _maxSize            = config.GetMaxSize();
     _timeToLiveSeconds  = config.GetTimeToLiveSeconds();
 }
Exemple #4
0
 public NearCacheConfig(NearCacheConfig config)
 {
     name               = config.GetName();
     evictionPolicy     = config.GetEvictionPolicy();
     inMemoryFormat     = config.GetInMemoryFormat();
     invalidateOnChange = config.IsInvalidateOnChange();
     maxIdleSeconds     = config.GetMaxIdleSeconds();
     maxSize            = config.GetMaxSize();
     timeToLiveSeconds  = config.GetTimeToLiveSeconds();
     cacheLocalEntries  = config.IsCacheLocalEntries();
 }
 public NearCacheConfig(NearCacheConfig config)
 {
     name = config.GetName();
     evictionPolicy = config.GetEvictionPolicy();
     inMemoryFormat = config.GetInMemoryFormat();
     invalidateOnChange = config.IsInvalidateOnChange();
     maxIdleSeconds = config.GetMaxIdleSeconds();
     maxSize = config.GetMaxSize();
     timeToLiveSeconds = config.GetTimeToLiveSeconds();
     cacheLocalEntries = config.IsCacheLocalEntries();
 }
Exemple #6
0
 protected BaseNearCache(string name, HazelcastClient client, NearCacheConfig nearCacheConfig)
 {
     _name              = name;
     Client             = client;
     _maxSize           = nearCacheConfig.MaxSize;
     _maxIdleMillis     = nearCacheConfig.MaxIdleSeconds * 1000;
     _inMemoryFormat    = nearCacheConfig.InMemoryFormat;
     _timeToLiveMillis  = nearCacheConfig.TimeToLiveSeconds * 1000;
     _evictionPolicy    = nearCacheConfig.EvictionPolicy;
     _records           = new ConcurrentDictionary <IData, Lazy <NearCacheRecord> >();
     _canCleanUp        = new AtomicBoolean(true);
     _canEvict          = new AtomicBoolean(true);
     _lastCleanup       = Clock.CurrentTimeMillis();
     _selectedComparer  = GetComparer(_evictionPolicy);
     _stat              = new NearCacheStatistics();
     InvalidateOnChange = nearCacheConfig.InvalidateOnChange;
 }
Exemple #7
0
 public ClientNearCache(string mapName, ClientNearCacheType cacheType, ClientContext context,
                        NearCacheConfig nearCacheConfig)
 {
     this.mapName       = mapName;
     this.cacheType     = cacheType;
     this.context       = context;
     maxSize            = nearCacheConfig.GetMaxSize();
     maxIdleMillis      = nearCacheConfig.GetMaxIdleSeconds() * 1000;
     inMemoryFormat     = nearCacheConfig.GetInMemoryFormat();
     timeToLiveMillis   = nearCacheConfig.GetTimeToLiveSeconds() * 1000;
     invalidateOnChange = nearCacheConfig.IsInvalidateOnChange();
     evictionPolicy     = (EvictionPolicy)Enum.Parse(typeof(EvictionPolicy), nearCacheConfig.GetEvictionPolicy());
     cache       = new ConcurrentDictionary <IData, CacheRecord>();
     canCleanUp  = new AtomicBoolean(true);
     canEvict    = new AtomicBoolean(true);
     lastCleanup = Clock.CurrentTimeMillis();
     if (invalidateOnChange)
     {
         AddInvalidateListener();
     }
 }
 /// <summary>
 /// Sets the data type used to store entries.
 /// <br/>
 /// Possible values:
 /// <ul>
 /// <li><c>BINARY</c>: keys and values are stored as binary data</li>
 /// <li><c>OBJECT</c>: values are stored in their object forms</li>
 /// <li><c>NATIVE</c>: keys and values are stored in native memory</li>
 /// </ul>
 /// The default value is <c>BINARY</c>.
 /// </summary>
 /// <param name="inMemoryFormat">the data type used to store entries</param>
 /// <returns>this Near Cache config instance</returns>
 public virtual NearCacheConfig SetInMemoryFormat(InMemoryFormat inMemoryFormat)
 {
     _inMemoryFormat = inMemoryFormat;
     return(this);
 }
 /// <summary>
 /// Converts a value <see cref="IData"/> to the internal cached value format.
 /// </summary>
 /// <param name="valueData">Value data.</param>
 /// <returns>Internal cached value.</returns>
 protected virtual object ToCachedValue(IData valueData)
 {
     return(InMemoryFormat.Equals(InMemoryFormat.Binary)
         ? valueData
         : SerializationService.ToObject <object>(valueData));
 }
 public virtual NearCacheConfig SetInMemoryFormat(InMemoryFormat inMemoryFormat)
 {
     this.inMemoryFormat = inMemoryFormat;
     return this;
 }
 public override NearCacheConfig SetInMemoryFormat(InMemoryFormat inMemoryFormat)
 {
     throw new NotSupportedException("This config is read-only");
 }
 public override NearCacheConfig SetInMemoryFormat(InMemoryFormat inMemoryFormat)
 {
     throw new NotSupportedException("This config is read-only");
 }