瀏覽代碼

Added OnFLushedCache event log

Pascal Coin 2 年之前
父節點
當前提交
3abb7ec050
共有 1 個文件被更改,包括 14 次插入0 次删除
  1. 14 0
      src/core/UPCAbstractMem.pas

+ 14 - 0
src/core/UPCAbstractMem.pas

@@ -139,6 +139,7 @@ type
     function GetMaxAccountKeysCache: Integer;
     procedure SetMaxAccountKeysCache(const Value: Integer);
     procedure SetSavingNewSafeboxMode(const Value: Boolean);
+    procedure OnCacheMemFlushedCache(const ASender : TCacheMem; const AProcessDesc : String; AElapsedMilis: Int64);
   protected
     procedure UpgradeAbstractMemVersion(const ACurrentHeaderVersion : Integer);
     function DoGetAccount(AAccountNumber : Integer; var AAccount : TAccount) : Boolean;
@@ -489,6 +490,7 @@ end;
 constructor TPCAbstractMem.Create(const ASafeboxFileName: string; AReadOnly: boolean);
 var
   LIsNewStructure : Boolean;
+  LCacheMem : TCacheMem;
 begin
   FStats.Clear;
 
@@ -515,6 +517,12 @@ begin
   end;
   if FAbstractMem is TFileMem then begin
     TFileMem(FAbstractMem).SetCachePerformance(True,1024,FMaxMemUsage,200000);
+    LCacheMem := TFileMem(FAbstractMem).LockCache;
+    Try
+      LCacheMem.OnFlushedCache := OnCacheMemFlushedCache;
+    Finally
+      TFileMem(FAbstractMem).UnlockCache;
+    End;
   end;
 
   DoInit(LIsNewStructure);
@@ -891,6 +899,12 @@ begin
   End;
 end;
 
+procedure TPCAbstractMem.OnCacheMemFlushedCache(const ASender: TCacheMem;
+  const AProcessDesc: String; AElapsedMilis: Int64);
+begin
+  TLog.NewLog(ltdebug,ASender.ClassName,Self.ClassName+' '+AProcessDesc)
+end;
+
 function TPCAbstractMem.AccountsCount: integer;
 begin
   Result := FAccounts.Count;