예제 #1
0
 private static string GetKey(ArchiveEntry entry)
 {
     if (entry.Store != null)
     {
         return(entry.Store.Key);
     }
     if (entry.Remove != null)
     {
         return(entry.Remove.Key);
     }
     throw new InvalidOperationException();
 }
예제 #2
0
        private static ArchiveEntry CreateArchiveEntry(ICacheNotification notification)
        {
            var archiveEntry = new ArchiveEntry
            {
                Store  = notification as StoreNotification,
                Clear  = notification as ClearNotification,
                Remove = notification as RemoveNotification,
                Touch  = notification as TouchNotification
            };

            return(archiveEntry);
        }
예제 #3
0
        private void OnNotification(int version, ArchiveEntry archiveEntry)
        {
            if (_lastVersion > version)
            {
                return;
            }

            if (!Full)
            {
                WriteSingleNotification(archiveEntry);
                _lastVersion = version;
            }
            else
            {
                CompactCache();
            }
        }
예제 #4
0
 private void WriteSingleNotification(ArchiveEntry archiveEntry)
 {
     Serializer.SerializeWithLengthPrefix(_outputStream, archiveEntry, PrefixStyle.Fixed32);
     _outputStream.FlushAsync();
 }