| 253 | // --------------------------------------------------------------------------- |
| 254 | |
| 255 | std::unique_ptr<DiskChunkCache> DiskChunkCache::open(PJ_CONTEXT *ctx) { |
| 256 | if (!pj_context_get_grid_cache_is_enabled(ctx)) { |
| 257 | return nullptr; |
| 258 | } |
| 259 | const auto cachePath = pj_context_get_grid_cache_filename(ctx); |
| 260 | if (cachePath.empty()) { |
| 261 | return nullptr; |
| 262 | } |
| 263 | |
| 264 | auto diskCache = |
| 265 | std::unique_ptr<DiskChunkCache>(new DiskChunkCache(ctx, cachePath)); |
| 266 | if (!diskCache->initialize()) |
| 267 | diskCache.reset(); |
| 268 | return diskCache; |
| 269 | } |
| 270 | |
| 271 | // --------------------------------------------------------------------------- |
| 272 |
no test coverage detected