public virtual void FillCache(int from, int to)
 {
     for (int i = from; i < to; ++i)
     {
         Assert.AreEqual(i.ToString(), ((string)cache.Produce(i, producer, null)));
     }
 }
        public virtual void TestProduce()
        {
            object  obj   = new object();
            ICache4 cache = ((ICache4)SubjectFixtureProvider.Value());
            object  value = cache.Produce(1, new _IFunction4_39(obj), null);

            Assert.AreSame(obj, value);
            Assert.AreSame(obj, cache.Produce(1, null, null));
        }
Exemple #3
0
 public TValue Produce(TKey key, Func <TKey, TValue> producer)
 {
     lock (sync)
     {
         return(implementation.Produce(key, producer));
     }
 }
        public virtual object Produce(object key, IFunction4 producer, IProcedure4 onDiscard
                                      )
        {
            _calls++;
            IFunction4 delegateProducer = new _IFunction4_26(this, producer);

            return(_delegate.Produce(key, delegateProducer, onDiscard));
        }
        public MethodDefinition ResolveMethod(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            return(_methodCache.Produce(method, GetMethod));
        }
        public TValue Produce(TKey key, Func <TKey, TValue> producer)
        {
            var hit = true;
            var result = _delegate.Produce(key, delegate(TKey newKey)
            {
                hit = false;
                return(producer(newKey));
            });

            TraceCacheHitMiss(key, hit);
            return(result);
        }
Exemple #7
0
 virtual protected object Cache4Produce(object key, IFunction4 producer)
 {
     return(_cache4.Produce(key, producer, null));
 }
 private AssemblyDefinition GetAssembly(Assembly assembly)
 {
     return(_assemblyCache.Produce(assembly, ReadAssembly));
 }
Exemple #9
0
        private static IMethodAnalyser GetAnalyserFor(MethodDefinition method)
        {
            var graph = _graphCache.Produce(method, CreateActionFlowGraph);

            return(new CecilMethodAnalyser(graph));
        }
Exemple #10
0
 private static FieldInfo GetBackingField(MethodInfo method)
 {
     return(_fieldCache.Produce(method, ResolveBackingField));
 }