Quick.MemoryCache.Types.pas 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. { ***************************************************************************
  2. Copyright (c) 2016-2019 Kike Pérez
  3. Unit : Quick.MemoryCache.Types
  4. Description : Memory Cache Types
  5. Author : Kike Pérez
  6. Version : 1.0
  7. Created : 14/07/2019
  8. Modified : 15/09/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.MemoryCache.Types;
  22. {$i QuickLib.inc}
  23. interface
  24. uses
  25. RTTI;
  26. type
  27. ICacheEntry = interface
  28. ['{3158454E-07D5-41A2-A0FA-D3917F6B58C1}']
  29. function GetCreationDate: TDateTime;
  30. function GetData: string;
  31. function GetExpiration: Cardinal;
  32. function GetExpirationDate: TDateTime;
  33. procedure SetCreationDate(const Value: TDateTime);
  34. procedure SetData(const Value: string);
  35. procedure SetExpirationDate(const Value: TDateTime);
  36. procedure SetExpiration(aMilliseconds : Cardinal);
  37. property CreationDate : TDateTime read GetCreationDate write SetCreationDate;
  38. property Expiration : Cardinal read GetExpiration write SetExpiration;
  39. property ExpirationDate : TDateTime read GetExpirationDate write SetExpirationDate;
  40. property Data : string read GetData write SetData;
  41. function Size : Integer;
  42. function IsExpired : Boolean;
  43. end;
  44. ICacheCompressor = interface
  45. ['{DE4FB31F-0A0B-49AF-88A6-41689C316DFE}']
  46. function Compress(const aValue : string) : string;
  47. function Decompress(const aValue : string) : string;
  48. end;
  49. ICacheSerializer = interface
  50. ['{F26B99AE-5080-4EDB-80CF-508E1A6F9EDE}']
  51. function Serialize(aObject : TObject) : string; overload;
  52. function Serialize(aArray : TArray<string>) : string; overload;
  53. function Serialize(aArray: TArray<TObject>): string; overload;
  54. procedure Deserialize(const aValue : string; aObject : TObject); overload;
  55. procedure Deserialize(const aValue : string; var aArray : TArray<string>); overload;
  56. procedure Deserialize(const aValue : string; var aArray: TArray<TObject>); overload;
  57. end;
  58. implementation
  59. end.