Exemplo n.º 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();
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        private void OnNotification(int version, ArchiveEntry archiveEntry)
        {
            if (_lastVersion > version)
            {
                return;
            }

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