Esempio n. 1
0
        /// <summary>
        /// Invoked for deleting mapping in cache becase it no longer exists in store.
        /// </summary>
        /// <param name="mapping">Storage representation of mapping.</param>
        public virtual void DeleteMapping(IStoreMapping mapping)
        {
            using (ReadLockScope rls = _cacheRoot.GetReadLockScope(false))
            {
                CacheShardMap csm = _cacheRoot.LookupById(mapping.ShardMapId);

                if (csm != null)
                {
                    using (WriteLockScope wlscsm = csm.GetWriteLockScope())
                    {
                        csm.Mapper.Remove(mapping);

                        // Update perf counters for remove mapping operation and mappings count.
                        csm.IncrementPerformanceCounter(PerformanceCounterName.MappingsRemovePerSec);
                        csm.SetPerformanceCounter(PerformanceCounterName.MappingsCount, csm.Mapper.GetMappingsCount());

                        Tracer.TraceVerbose(
                            TraceSourceConstants.ComponentNames.ShardMapManager,
                            "OnDeleteMapping",
                            "Cache delete mapping complete. Mapping Id: {0}",
                            mapping.Id);
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Invoked for deleting mapping in cache becase it no longer exists in store.
        /// </summary>
        /// <param name="mapping">Storage representation of mapping.</param>
        public virtual void DeleteMapping(IStoreMapping mapping)
        {
            using (ReadLockScope rls = _cacheRoot.GetReadLockScope(false))
            {
                CacheShardMap csm = _cacheRoot.LookupById(mapping.ShardMapId);

                if (csm != null)
                {
                    using (WriteLockScope wlscsm = csm.GetWriteLockScope())
                    {
                        csm.Mapper.Remove(mapping);
                        Tracer.TraceVerbose(
                            TraceSourceConstants.ComponentNames.ShardMapManager,
                            "OnDeleteMapping",
                            "Cache delete mapping complete. Mapping Id: {0}",
                            mapping.Id);
                    }
                }
            }
        }