Ejemplo n.º 1
0
        public ISpecificPersistency <T> GetSpecific <T>()
        {
            Type type = typeof(T);

            log.LogTrace("GetSpecific<{0}>", type);

            if (persistencyTable.TryGetValue(type, out var persistency))
            {
                return((ISpecificPersistency <T>)persistency);
            }

            if (type == typeof(SortedSetEntry))
            {
                log.LogDebug("Creating default sorted set persistency handler");
                persistency = new SortedSetSerialization <T>(loggerFactory.CreateLogger <SortedSetSerialization <T> >(), this, IndexManager);
            }
            else
            {
                log.LogDebug("Creating default list persistency handler");
                persistency = new ListSerialization <T>(loggerFactory.CreateLogger <ListSerialization <T> >(),
                                                        this,
                                                        new RedisList(loggerFactory.CreateLogger <RedisList>(), this, IndexManager),
                                                        IndexManager,
                                                        defaultSerialiser);
            }

            persistencyTable.Add(type, persistency);
            return((ISpecificPersistency <T>)persistency);
        }
Ejemplo n.º 2
0
        public void RegisterSet <T>(IDataSerializer serializer)
        {
            var persistency = new ListSerialization <T>(loggerFactory.CreateLogger <ListSerialization <T> >(),
                                                        link,
                                                        new RedisSet(loggerFactory.CreateLogger <RedisSet>(), link, link.IndexManager),
                                                        link.IndexManager,
                                                        serializer);

            link.Register(persistency);
        }
Ejemplo n.º 3
0
 public void Setup()
 {
     data         = new MainDataOne();
     indexManager = new Mock <IMainIndexManager>();
     redisSetList = new Mock <IRedisSetList>();
     key          = new ObjectKey("Test");
     redis        = new Mock <IRedisLink>();
     redis.Setup(item => item.Resilience).Returns(new ResilienceHandler(new NullLogger <ResilienceHandler>(), new ResilienceConfig()));
     redis.Setup(item => item.State).Returns(ChannelState.Open);
     redis.Setup(item => item.LinkId).Returns(0);
     redis.Setup(item => item.Generator).Returns(new ScriptGenerator());
     serializer = new Mock <IDataSerializer>();
     database   = new Mock <IDatabaseAsync>();
     instance   = new ListSerialization <MainDataOne>(new NullLogger <ListSerialization <MainDataOne> >(), redis.Object, redisSetList.Object, indexManager.Object, serializer.Object);
 }