Beispiel #1
0
        static void RunTest(DateTime time, MemoryCache internalCache, ClassWithComplexClassList @object)
        {
            var cache = new Cache(new CacheConfiguration(internalCache));

            cache.Add(@object, time);

            var cacheItem = cache.Get <ClassWithComplexClassList>(item => item.Id == 1);

            cache.RemoveAllGraphs <ClassWithComplexClassList>();
        }
Beispiel #2
0
        static ClassWithComplexClassList GetObject()
        {
            var @object = new ClassWithComplexClassList();

            @object.Id      = 1;
            @object.Objects = new List <ComplexClass>
            {
                new ComplexClass
                {
                    Id    = 1,
                    Child = new SimpleClass {
                        Id = 1, Name = "SimpleClass1"
                    }
                },
                new ComplexClass
                {
                    Id    = 2,
                    Child = new SimpleClass {
                        Id = 2, Name = "SimpleClass2"
                    }
                },
                new ComplexClass
                {
                    Id    = 2,
                    Child = new SimpleClass {
                        Id = 3, Name = "SimpleClass3"
                    }
                },
                new ComplexClass
                {
                    Id    = 2,
                    Child = new SimpleClass {
                        Id = 4, Name = "SimpleClass4"
                    }
                },
                new ComplexClass
                {
                    Id    = 2,
                    Child = new SimpleClass {
                        Id = 5, Name = "SimpleClass5"
                    }
                },
                new ComplexClass
                {
                    Id    = 2,
                    Child = new SimpleClass {
                        Id = 6, Name = "SimpleClass6"
                    }
                }
            };

            return(@object);
        }
Beispiel #3
0
        static ClassWithComplexClassList GetObject()
        {
            var @object = new ClassWithComplexClassList();
            @object.Id = 1;
            @object.Objects = new List<ComplexClass>
            {
                new ComplexClass
                {
                    Id = 1,
                    Child = new SimpleClass { Id = 1, Name = "SimpleClass1" }
                },
                new ComplexClass
                {
                    Id = 2,
                    Child = new SimpleClass { Id =2, Name = "SimpleClass2" }
                },
                new ComplexClass
                {
                    Id = 2,
                    Child = new SimpleClass { Id =3, Name = "SimpleClass3" }
                },
                new ComplexClass
                {
                    Id = 2,
                    Child = new SimpleClass { Id =4, Name = "SimpleClass4" }
                },
                new ComplexClass
                {
                    Id = 2,
                    Child = new SimpleClass { Id =5, Name = "SimpleClass5" }
                },
                new ComplexClass
                {
                    Id = 2,
                    Child = new SimpleClass { Id =6, Name = "SimpleClass6" }
                }
            };

            return @object;
        }
Beispiel #4
0
        static void RunTest(DateTime time, MemoryCache internalCache, ClassWithComplexClassList @object)
        {
            var cache = new Cache(new CacheConfiguration(internalCache));

            cache.Add(@object, time);

            var cacheItem = cache.Get<ClassWithComplexClassList>(item => item.Id == 1);
            cache.RemoveAllGraphs<ClassWithComplexClassList>();
        }