persistent_cache_options.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include <string>
  7. #include "cache/cache_key.h"
  8. #include "monitoring/statistics_impl.h"
  9. #include "rocksdb/persistent_cache.h"
  10. namespace ROCKSDB_NAMESPACE {
  11. // PersistentCacheOptions
  12. //
  13. // This describe the caching behavior for page cache
  14. // This is used to pass the context for caching and the cache handle
  15. struct PersistentCacheOptions {
  16. PersistentCacheOptions() {}
  17. explicit PersistentCacheOptions(
  18. const std::shared_ptr<PersistentCache>& _persistent_cache,
  19. const OffsetableCacheKey& _base_cache_key, Statistics* const _statistics)
  20. : persistent_cache(_persistent_cache),
  21. base_cache_key(_base_cache_key),
  22. statistics(_statistics) {}
  23. std::shared_ptr<PersistentCache> persistent_cache;
  24. OffsetableCacheKey base_cache_key;
  25. Statistics* statistics = nullptr;
  26. static const PersistentCacheOptions kEmpty;
  27. };
  28. } // namespace ROCKSDB_NAMESPACE