hi,
i have two applications - one is an asp.net website and the other is a windows service.
both applications are referencing my business layer (library project), which itself is referencing my data access layer (library project) that itself uses the enterprise library data application block to receive the data form a sql server 2005 database.
currently i use the System.Web.Caching.Cache object in my BL to cache some of my objects:
public static System.Web.Caching.Cache Cache
{
get
{
if(cache == null)
{
if (System.Web.HttpContext.Current != null)
{
//asp.net
cache = System.Web.HttpContext.Current.Cache;
}
else
{
//windows service
cache = System.Web.HttpRuntime.Cache;
}
}
return cache;
}
}
as both applications are running on their own - they both are using a separate Cache object on their own - and this is the problem actually:
if i change a object in the asp.net website and save it to the DB. the object to this cache key is removed from the cache - the asp.net application's cache! that's fine.
but the windows service's Cache becomes stale!
vice-versa
is it possible that both applications are using the same Cache? One Cache for both applications?
the only option i have i think about is that i will have to use SqlDependency with
is there any other way?
EDIT: i just found http://www.codeplex.com/SharedCache. i will give it a try. as because velocity will be in release candidate status until mid 2009.