|
@@ -76,6 +76,7 @@ type
|
|
function GetValue(const aKey : string) : T;
|
|
function GetValue(const aKey : string) : T;
|
|
function TryGetValue(const aKey : string; out aValue : T) : Boolean;
|
|
function TryGetValue(const aKey : string; out aValue : T) : Boolean;
|
|
procedure RemoveValue(const aKey : string);
|
|
procedure RemoveValue(const aKey : string);
|
|
|
|
+ procedure Refresh(const aKey: string; aExpirationMilliseconds : Integer);
|
|
procedure Flush;
|
|
procedure Flush;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -111,6 +112,7 @@ type
|
|
function TryGetValue(const aKey : string; out aValue : TArray<string>) : Boolean; overload;
|
|
function TryGetValue(const aKey : string; out aValue : TArray<string>) : Boolean; overload;
|
|
function TryGetValue(const aKey : string; out aValue : TArray<TObject>) : Boolean; overload;
|
|
function TryGetValue(const aKey : string; out aValue : TArray<TObject>) : Boolean; overload;
|
|
procedure RemoveValue(const aKey : string);
|
|
procedure RemoveValue(const aKey : string);
|
|
|
|
+ procedure Refresh(const aKey: string; aExpirationMilliseconds : Integer);
|
|
procedure Flush;
|
|
procedure Flush;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -182,6 +184,7 @@ type
|
|
property OnEndPurgerJob : TEndPurgerJobEvent read fOnEndPurgerJob write SetOnEndPurgerJob;
|
|
property OnEndPurgerJob : TEndPurgerJobEvent read fOnEndPurgerJob write SetOnEndPurgerJob;
|
|
property OnPurgeJobError : TPurgerJobErrorEvent read fOnPurgerJobError write SetOnPurgerJobError;
|
|
property OnPurgeJobError : TPurgerJobErrorEvent read fOnPurgerJobError write SetOnPurgerJobError;
|
|
procedure RemoveValue(const aKey : string); virtual;
|
|
procedure RemoveValue(const aKey : string); virtual;
|
|
|
|
+ procedure Refresh(const aKey: string; aExpirationMilliseconds : Integer);
|
|
procedure Flush; virtual;
|
|
procedure Flush; virtual;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -281,6 +284,17 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TMemoryCacheBase.Refresh(const aKey: string; aExpirationMilliseconds : Integer);
|
|
|
|
+var
|
|
|
|
+ cacheitem : ICacheEntry;
|
|
|
|
+begin
|
|
|
|
+ if fItems.TryGetValue(aKey,cacheitem) then
|
|
|
|
+ begin
|
|
|
|
+ cacheitem.CreationDate := Now;
|
|
|
|
+ cacheitem.Expiration := aExpirationMilliseconds;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TMemoryCacheBase.RemoveExpiredCacheEntries;
|
|
procedure TMemoryCacheBase.RemoveExpiredCacheEntries;
|
|
var
|
|
var
|
|
pair : TPair<string,ICacheEntry>;
|
|
pair : TPair<string,ICacheEntry>;
|