public RedisDocumentCacheFactory(ILoggerFactory factory, IRedisLink redis, LocalDocumentsCache local, IJsonSerializer serializer)
 {
     this.redis      = redis ?? throw new ArgumentNullException(nameof(redis));
     this.local      = local ?? throw new ArgumentNullException(nameof(local));
     this.serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
     this.factory    = factory ?? throw new ArgumentNullException(nameof(factory));
 }
示例#2
0
        public RedisDocumentCache(ILogger <RedisDocumentCache> log, POSTaggerType tagger, IRedisLink manager, LocalDocumentsCache local, IJsonSerializer serializer)
        {
            this.tagger  = tagger;
            this.manager = manager ?? throw new ArgumentNullException(nameof(manager));
            this.local   = local ?? throw new ArgumentNullException(nameof(local));
            this.log     = log ?? throw new ArgumentNullException(nameof(log));

            manager.PersistencyRegistration.RegisterObjectHashSingle <LightDocument>(new JsonDataSerializer(serializer));
        }
示例#3
0
        public RedisDocumentCache(ILogger <RedisDocumentCache> log, POSTaggerType tagger, IRedisLink manager, LocalDocumentsCache local)
        {
            this.tagger  = tagger;
            this.manager = manager ?? throw new ArgumentNullException(nameof(manager));
            this.local   = local ?? throw new ArgumentNullException(nameof(local));
            this.log     = log ?? throw new ArgumentNullException(nameof(log));

            if (!manager.HasDefinition <LightDocument>())
            {
                manager.RegisterNormalized <LightDocument>(new XmlDataSerializer()).IsSingleInstance = true;
            }
        }
        public void Setup()
        {
            local = new LocalDocumentsCache(ApplicationLogging.LoggerFactory.CreateLogger <LocalDocumentsCache>(), new MemoryCache(new MemoryCacheOptions()));
            redis = new RedisInside.Redis(i => i.Port(6666).LogTo(item => log.LogDebug(item)));
            IServiceCollection service = new ServiceCollection();

            service.RegisterModule(new RedisServerModule(new RedisConfiguration("localhost", 6666)
            {
                ServiceName = "Test"
            }));
            link     = service.BuildServiceProvider().GetService <IRedisLink>();
            instance = new RedisDocumentCache(new NullLogger <RedisDocumentCache>(), POSTaggerType.Simple, link, local);
        }
 public void Setup()
 {
     instance = new LocalDocumentsCache(new NullLogger <LocalDocumentsCache>(), new MemoryCache(new MemoryCacheOptions()));
 }