2
0

Quick.Cache.Intf.pas 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. { ***************************************************************************
  2. Copyright (c) 2016-2019 Kike Pérez
  3. Unit : Quick.HttpServer.Intf.Cache
  4. Description : Http Server Cache Interface
  5. Author : Kike Pérez
  6. Version : 1.0
  7. Created : 12/10/2019
  8. Modified : 27/10/2019
  9. This file is part of QuickLib: https://github.com/exilon/QuickLib
  10. ***************************************************************************
  11. Licensed under the Apache License, Version 2.0 (the "License");
  12. you may not use this file except in compliance with the License.
  13. You may obtain a copy of the License at
  14. http://www.apache.org/licenses/LICENSE-2.0
  15. Unless required by applicable law or agreed to in writing, software
  16. distributed under the License is distributed on an "AS IS" BASIS,
  17. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. See the License for the specific language governing permissions and
  19. limitations under the License.
  20. *************************************************************************** }
  21. unit Quick.Cache.Intf;
  22. {$i QuickLib.inc}
  23. interface
  24. type
  25. ICache = interface
  26. ['{CF5061E1-BEAC-4CCC-8469-5020968116B9}']
  27. function GetCompression: Boolean;
  28. procedure SetCompression(const Value: Boolean);
  29. function GetCachedObjects: Integer;
  30. function GetCacheSize: Integer;
  31. property Compression : Boolean read GetCompression write SetCompression;
  32. property CachedObjects : Integer read GetCachedObjects;
  33. property CacheSize : Integer read GetCacheSize;
  34. procedure SetValue(const aKey : string; aValue : TObject; aExpirationMilliseconds : Integer = 0); overload;
  35. procedure SetValue(const aKey : string; aValue : TObject; aExpirationDate : TDateTime); overload;
  36. procedure SetValue(const aKey, aValue : string; aExpirationMilliseconds : Integer = 0); overload;
  37. procedure SetValue(const aKey, aValue : string; aExpirationDate : TDateTime); overload;
  38. procedure SetValue(const aKey : string; aValue : TArray<string>; aExpirationMilliseconds : Integer = 0); overload;
  39. procedure SetValue(const aKey : string; aValue : TArray<string>; aExpirationDate : TDateTime); overload;
  40. procedure SetValue(const aKey : string; aValue : TArray<TObject>; aExpirationMilliseconds : Integer = 0); overload;
  41. procedure SetValue(const aKey : string; aValue : TArray<TObject>; aExpirationDate : TDateTime); overload;
  42. function GetValue(const aKey : string) : string; overload;
  43. function TryGetValue(const aKey : string; aValue : TObject) : Boolean; overload;
  44. function TryGetValue(const aKey : string; out aValue : string) : Boolean; overload;
  45. function TryGetValue(const aKey : string; out aValue : TArray<string>) : Boolean; overload;
  46. function TryGetValue(const aKey : string; out aValue : TArray<TObject>) : Boolean; overload;
  47. procedure RemoveValue(const aKey : string);
  48. procedure Flush;
  49. end;
  50. IMemoryCache = ICache;
  51. implementation
  52. end.