Quick.MemoryCache.Compressor.GZip.pas 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. { ***************************************************************************
  2. Copyright (c) 2016-2019 Kike Pérez
  3. Unit : Quick.MemoryCache.Compressor.GZip
  4. Description : Compress Cache data
  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.Compressor.GZip;
  22. {$i QuickLib.inc}
  23. interface
  24. uses
  25. Quick.Compression,
  26. Quick.MemoryCache.Types;
  27. type
  28. TCacheCompressorGZip = class(TInterfacedObject,ICacheCompressor)
  29. public
  30. function Compress(const aValue : string) : string;
  31. function Decompress(const aValue : string) : string;
  32. end;
  33. implementation
  34. { TCacheCompresorGZip }
  35. function TCacheCompressorGZip.Compress(const aValue: string): string;
  36. begin
  37. Result := CompressGZipString(aValue,TCompressionLevel.zcFastest);
  38. end;
  39. function TCacheCompressorGZip.Decompress(const aValue: string): string;
  40. begin
  41. Result := DeCompressGZipString(aValue);
  42. end;
  43. end.