Invalidates the cached items of the set in the context.
using(Context.Push(LocalContext.Create()))
{
Set cages = dataDomain.Extent(typeof(Cage))["Size > 2"];
cages = QueryCacheManager.CacheSet(cages);
// these operations are served from memory
if (cages.Count == 0)
Console.WriteLine("No cages found.");
else
{
foreach (Cage cage in cages)
{
Console.WriteLine("Cage: {0}", cage);
}
}
}
Invalidating the query cache manually
using(Context.Push(ShortRunningTransactionContext.Create()))
{
Set cages = dataDomain.Extent(typeof(Cage))["Size > 2"];
cages = QueryCacheManager.CacheSet(cages);
... //display the cached set
if (cages.Count > 0)
{
// modifying a cage size
Cage cage = (Cage)cages.GetItem(0);
cage.Size = 1;
// we need to invalidate the query cache to see the updated result
QueryCacheManager.Invalidate(cages);
Console.WriteLine("Number of cages after modification: {0}", cages.Count);
}
}
using(Context.Push(LocalContext.Create()))
{
Set cages = dataDomain.Extent(typeof(Cage))["Size > 2"];
cages = QueryCacheManager.CacheSet(cages);
// these operations are served from memory
if (cages.Count == 0)
Console.WriteLine("No cages found.");
else
{
foreach (Cage cage in cages)
{
Console.WriteLine("Cage: {0}", cage);
}
}
}
Invalidating the query cache manually
using(Context.Push(ShortRunningTransactionContext.Create()))
{
Set cages = dataDomain.Extent(typeof(Cage))["Size > 2"];
cages = QueryCacheManager.CacheSet(cages);
... //display the cached set
if (cages.Count > 0)
{
// modifying a cage size
Cage cage = (Cage)cages.GetItem(0);
cage.Size = 1;
// we need to invalidate the query cache to see the updated result
QueryCacheManager.Invalidate(cages);
Console.WriteLine("Number of cages after modification: {0}", cages.Count);
}
}
Namespace: TechTalk.Genome
Assembly: TechTalk.Genome (in TechTalk.Genome.dll)
Version: 4.2.4.4
Editions: Professional, Evaluation, Express
QueryCacheManager Class | TechTalk.Genome Namespace | QueryCacheManager.Invalidate Overload List | !:CacheSet(Context, Set) | PredictiveCacheManager.PrecacheSet | Invalidate | !:CacheSet(Context, Set) | PredictiveCacheManager.PrecacheSet | Invalidate