mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +08:00
Backed out changeset: 021b467c8725
--HG-- branch : 1.x
This commit is contained in:
@@ -23,24 +23,6 @@ namespace Orchard.Caching {
|
|||||||
return entry.Result;
|
return entry.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGet(TKey key, out TResult value){
|
|
||||||
CacheEntry cacheEntry;
|
|
||||||
if (_entries.TryGetValue(key, out cacheEntry)){
|
|
||||||
value = cacheEntry.Result;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
value = default(TResult);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsValid(TKey key){
|
|
||||||
CacheEntry currentEntry;
|
|
||||||
if (_entries.TryGetValue(key, out currentEntry)){
|
|
||||||
return currentEntry.Tokens.Any(t => !t.IsCurrent);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CacheEntry AddEntry(TKey k, Func<AcquireContext<TKey>, TResult> acquire) {
|
private CacheEntry AddEntry(TKey k, Func<AcquireContext<TKey>, TResult> acquire) {
|
||||||
var entry = CreateEntry(k, acquire);
|
var entry = CreateEntry(k, acquire);
|
||||||
PropagateTokens(entry);
|
PropagateTokens(entry);
|
||||||
|
|||||||
@@ -3,7 +3,5 @@
|
|||||||
namespace Orchard.Caching {
|
namespace Orchard.Caching {
|
||||||
public interface ICache<TKey, TResult> {
|
public interface ICache<TKey, TResult> {
|
||||||
TResult Get(TKey key, Func<AcquireContext<TKey>, TResult> acquire);
|
TResult Get(TKey key, Func<AcquireContext<TKey>, TResult> acquire);
|
||||||
bool IsValid(TKey key);
|
|
||||||
bool TryGet(TKey key, out TResult value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user