Click here to Skip to main content
15,895,142 members
Articles / Web Development

MyCache: Distributed caching engine for an ASP.NET web farm - Part II: The internal details

Rate me:
Please Sign up or sign in to vote.
4.97/5 (20 votes)
27 Dec 2010CPOL17 min read 81K   1.2K   54  
Internal implementation of MyCache: A distributed caching engine for ASP.NET applications deployed under a load-balanced environment in web farms, which is built on top of WCF and the Microsoft Caching Application Block.
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MyCacheAPI.CacheService {
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="CacheService.ICacheService", SessionMode=System.ServiceModel.SessionMode.Required)]
    public interface ICacheService {
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICacheService/Add", ReplyAction="http://tempuri.org/ICacheService/AddResponse")]
        void Add(string Key, object Value);
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICacheService/Insert", ReplyAction="http://tempuri.org/ICacheService/InsertResponse")]
        void Insert(string Key, object Value, string DependencyFilePath, string Priority, System.DateTime AbsoluteExpiration, System.TimeSpan SlidingExpiration);
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICacheService/Remove", ReplyAction="http://tempuri.org/ICacheService/RemoveResponse")]
        void Remove(string Key);
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICacheService/Get", ReplyAction="http://tempuri.org/ICacheService/GetResponse")]
        object Get(string Key);
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICacheService/Exists", ReplyAction="http://tempuri.org/ICacheService/ExistsResponse")]
        bool Exists(string Key);
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICacheService/SetLock", ReplyAction="http://tempuri.org/ICacheService/SetLockResponse")]
        bool SetLock(string Key);
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICacheService/ReleaseLock", ReplyAction="http://tempuri.org/ICacheService/ReleaseLockResponse")]
        void ReleaseLock(string Key);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface ICacheServiceChannel : MyCacheAPI.CacheService.ICacheService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class CacheServiceClient : System.ServiceModel.ClientBase<MyCacheAPI.CacheService.ICacheService>, MyCacheAPI.CacheService.ICacheService {
        
        public CacheServiceClient() {
        }
        
        public CacheServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public CacheServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public CacheServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public CacheServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }
        
        public void Add(string Key, object Value) {
            base.Channel.Add(Key, Value);
        }
        
        public void Insert(string Key, object Value, string DependencyFilePath, string Priority, System.DateTime AbsoluteExpiration, System.TimeSpan SlidingExpiration) {
            base.Channel.Insert(Key, Value, DependencyFilePath, Priority, AbsoluteExpiration, SlidingExpiration);
        }
        
        public void Remove(string Key) {
            base.Channel.Remove(Key);
        }
        
        public object Get(string Key) {
            return base.Channel.Get(Key);
        }
        
        public bool Exists(string Key) {
            return base.Channel.Exists(Key);
        }
        
        public bool SetLock(string Key) {
            return base.Channel.SetLock(Key);
        }
        
        public void ReleaseLock(string Key) {
            base.Channel.ReleaseLock(Key);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder SmartAspects
Bangladesh Bangladesh
I write codes to make life easier, and that pretty much describes me.

Comments and Discussions