Exemplo n.º 1
0
 public IndexWriter(Stream stream, bool disposeStream, IKeySerializer <TKey> keySerializer)
 {
     this.underlyingStream = stream;
     this.disposeStream    = disposeStream;
     this.keySerializer    = keySerializer;
     this.buffer           = new MemoryStream(32768);
     this.writer           = new BinaryWriter(this.buffer, Encoding.UTF8);
 }
Exemplo n.º 2
0
        public V1IndexReader(Stream stream, bool disposeStream, IKeySerializer <TKey> keySerializer)
        {
            this.underlyingStream = stream;
            this.disposeStream    = disposeStream;
            this.keySerializer    = keySerializer;

            this.buffer = new MemoryStream((int)this.underlyingStream.Length);
            this.reader = new BinaryReader(this.buffer);
        }
Exemplo n.º 3
0
 public SimpleCache(IDistributedCache cache, IServiceProvider serviceProvider, SimpleCacheOptions <TKey, TValue> options)
 {
     _cache                        = cache;
     _serviceProvider              = serviceProvider;
     _keySpace                     = options.KeySpace ?? typeof(TValue).FullName + ":";
     _keySerializer                = options.KeySerializer ?? new DefaultKeySerializer();
     _valueSerializer              = options.ValueSerializer ?? new JsonValueSerializer();
     _defaultEntryOptions          = options.DefaultEntryOptions ?? new DistributedCacheEntryOptions();
     _valueFactory                 = options.ValueFactory;
     _fallbackToFactoryOnException = options.FallbackToFactoryOnException;
 }
 public KeyService(
     KeyRackOptions options,
     IKeyRepository repository,
     IKeySerializer serializer,
     ITimeKeeper timeKeeper,
     ILogger <KeyService> logger)
 {
     _options    = options;
     _repository = repository;
     _serializer = serializer;
     _timeKeeper = timeKeeper;
     _logger     = logger;
 }
Exemplo n.º 5
0
        public MemcacheClientConfiguration()
        {
            Authenticator = null;
            PoolSize      = 2;
            DeadTimeout   = TimeSpan.FromSeconds(15);
            SocketTimeout = TimeSpan.FromMilliseconds(200);
            QueueTimeout  = Timeout.Infinite;
            QueueLength   = 0;
            TransportConnectTimerPeriod = TimeSpan.FromMilliseconds(1000);
            Replicas = 0;

            const int sixtyFourKb = 1 << 16;

            TransportReceiveBufferSize = sixtyFourKb;
            TransportSendBufferSize    = sixtyFourKb;

            KeySerializer = new UTF8KeySerializer();
        }
Exemplo n.º 6
0
        public MemcacheClientConfiguration()
        {
            Authenticator = null;
            PoolSize      = 2;
            DeadTimeout   = TimeSpan.FromSeconds(15);
            SocketTimeout = TimeSpan.FromMilliseconds(200);
            QueueTimeout  = Timeout.Infinite;
            QueueLength   = 0;
            TransportConnectTimerPeriod = TimeSpan.FromMilliseconds(1000);
            Replicas = 0;

            // The point is having something just bigger than the MTU. I could use 10KB to handle jumbo frames also.
            const int tenKB = 10 * 1024;

            PinnedBufferSize = tenKB;

            const int sixtyFourKB = 1 << 16;

            TransportReceiveBufferSize = sixtyFourKB;
            TransportSendBufferSize    = sixtyFourKB;

            KeySerializer = new UTF8KeySerializer();
        }
Exemplo n.º 7
0
 public V3IndexReader(Stream stream, bool disposeStream, IKeySerializer <TKey> keySerializer)
     : base(stream, disposeStream, keySerializer)
 {
 }
Exemplo n.º 8
0
 public BinarySerializer(IKeySerializer <TKey> keySerializer)
 {
     this.keySerializer = keySerializer;
 }
Exemplo n.º 9
0
        public static SimpleCacheOptions <TKey, TValue> WithKeySerializer <TKey, TValue>(this SimpleCacheOptions <TKey, TValue> options, IKeySerializer keySerializer) where TValue : class
        {
            options.KeySerializer = keySerializer;

            return(options);
        }
 public KeyServiceConcurrencyTests()
 {
     _options    = CreateTestOptions();
     _timeKeeper = new TimeKeeper(_options);
     _serializer = new DefaultKeySerializer();
 }
Exemplo n.º 11
0
 public MemoryCacheBasedQueryCache(IKeySerializer <TKey> keySerializer)
 {
     _keySerializer = keySerializer;
 }