Caching Application Block in WCF

Topics: Caching Application Block
Oct 12, 2008 at 9:29 AM

Whether any one has tried to use the Caching application Block in WCF.

I need to cache the data and expose as WCF service and this need to be accessed from Silverlight2 control. I will be having 2 endpoints(one in HTTP binding and othter in Nettcp binding)

My Interface is as follows:

[ServiceContract]

 

 

public interface ICacheUpdate

 

{

[OperationContract]

 

int AddtoCache(object datatobecached);

 

[OperationContract]

 

int ReadCache(string dataId, out object dataretrieved);

 

 

}


My service implementation is as follows:

public class RealTimeUpdateService : ICacheUpdate
{

 

 

private ICacheManager mPerformancedataCache = null;

public
RealTimeUpdateService()

 

{

 

mPerformancedataCache = CacheFactory.GetCacheManager("Default Cache Manager");

 

}

#region ICacheUpdate Members
public int AddtoCache(object datatobecached)
{

 

// Code to add into the cache
}

 

 

public int ReadCache(string dataId, out object dataretrieved)
{

 

 

code  to read the cache

 

 

 

}

When I create a client and cal the AddtoCache method, it throws an exception as "Object reference not set to an instance of an object"

This looks like mPerformancedataCache  is not getting initilized.

Any help!!!!!!!

Thanks
Muru