Ejemplo n.º 1
0
        public void Put(string key, CacheEntry entry)
        {
            var condition = _serializer.CanSerialize(entry) && (_serializer.CanDeserialize(entry.Value?.GetType()));

            RedisAction(condition, () =>
            {
                entry.Key = key;
                Database.ObjectSet(_serializer, BuildCacheKey(key), entry, !_configuration.DisableCompression, entry.Duration);
                if (entry.Dependencies != null && entry.Dependencies.Any())
                {
                    EnlistDependencyKeys(key, entry.Dependencies);
                }

                // Other nodes must remove this entry from their local cache
                PostMessage("remove^" + key);
            });
        }