| 357 | } |
| 358 | |
| 359 | Status NewPersistentCache(const PersistentCacheConfig& config, |
| 360 | std::shared_ptr<PersistentCache>* cache) { |
| 361 | if (!cache) { |
| 362 | return Status::IOError("invalid argument cache"); |
| 363 | } |
| 364 | std::shared_ptr<PersistentCacheImpl::Statistics> stats{new PersistentCacheImpl::Statistics}; |
| 365 | auto pcache = std::make_shared<PersistentCacheImpl>(config, stats); |
| 366 | Status s = pcache->Open(); |
| 367 | |
| 368 | if (!s.ok()) { |
| 369 | return s; |
| 370 | } |
| 371 | |
| 372 | *cache = pcache; |
| 373 | return s; |
| 374 | } |
| 375 | } // namespace leveldb |