FileBlobCache.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. ** Copyright 2017, The Android Open Source Project
  3. **
  4. ** Licensed under the Apache License, Version 2.0 (the "License");
  5. ** you may not use this file except in compliance with the License.
  6. ** You may obtain a copy of the License at
  7. **
  8. ** http://www.apache.org/licenses/LICENSE-2.0
  9. **
  10. ** Unless required by applicable law or agreed to in writing, software
  11. ** distributed under the License is distributed on an "AS IS" BASIS,
  12. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. ** See the License for the specific language governing permissions and
  14. ** limitations under the License.
  15. */
  16. #ifndef ANDROID_FILE_BLOB_CACHE_H
  17. #define ANDROID_FILE_BLOB_CACHE_H
  18. #include "BlobCache.h"
  19. #include <string>
  20. namespace android {
  21. class FileBlobCache : public BlobCache {
  22. public:
  23. // FileBlobCache attempts to load the saved cache contents from disk into
  24. // BlobCache.
  25. FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize,
  26. const std::string& filename);
  27. // writeToFile attempts to save the current contents of BlobCache to
  28. // disk.
  29. void writeToFile();
  30. private:
  31. // mFilename is the name of the file for storing cache contents.
  32. std::string mFilename;
  33. };
  34. } // namespace android
  35. #endif // ANDROID_BLOB_CACHE_H