| 231 | // --------------------------------------------------------------------------- |
| 232 | |
| 233 | std::unique_ptr<DiskChunkCache> DiskChunkCache::open(PJ_CONTEXT *ctx) { |
| 234 | if (!pj_context_get_grid_cache_is_enabled(ctx)) { |
| 235 | return nullptr; |
| 236 | } |
| 237 | const auto cachePath = pj_context_get_grid_cache_filename(ctx); |
| 238 | if (cachePath.empty()) { |
| 239 | return nullptr; |
| 240 | } |
| 241 | |
| 242 | auto diskCache = |
| 243 | std::unique_ptr<DiskChunkCache>(new DiskChunkCache(ctx, cachePath)); |
| 244 | if (!diskCache->initialize()) |
| 245 | diskCache.reset(); |
| 246 | return diskCache; |
| 247 | } |
| 248 | |
| 249 | // --------------------------------------------------------------------------- |
| 250 |
no test coverage detected