2
0

Quick.MemoryCache.Compressor.LZO.pas 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. { ***************************************************************************
  2. Copyright (c) 2016-2019 Kike Pérez
  3. Unit : Quick.MemoryCache.Compressor.LZO
  4. Description : Compress Cache data
  5. Author : Kike Pérez
  6. Version : 1.0
  7. Created : 15/07/2019
  8. Modified : 22/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.Compressor.LZO;
  22. {$i QuickLib.inc}
  23. interface
  24. uses
  25. Quick.MemoryCache.Types,
  26. Quick.Compression.LZO;
  27. type
  28. TCacheCompressorLZO = class(TInterfacedObject,ICacheCompressor)
  29. public
  30. function Compress(const aValue : string) : string;
  31. function Decompress(const aValue : string) : string;
  32. end;
  33. implementation
  34. { TCacheCompresorLZO }
  35. function TCacheCompressorLZO.Compress(const aValue: string): string;
  36. var
  37. lzo : TLZOCompressor;
  38. begin
  39. lzo := TLZOCompressor.Create;
  40. try
  41. Result := lzo.Compress(aValue);
  42. finally
  43. lzo.Free;
  44. end;
  45. end;
  46. function TCacheCompressorLZO.Decompress(const aValue: string): string;
  47. var
  48. lzo : TLZOCompressor;
  49. begin
  50. lzo := TLZOCompressor.Create;
  51. try
  52. Result := lzo.Decompress(aValue);
  53. finally
  54. lzo.Free;
  55. end;
  56. end;
  57. end.