acdh-oeaw / arche-diss-cache
Response and resources cache for ARCHE dissemination services
3.0.9
2026-07-17 15:37 UTC
Requires
- php: >=8.3
- ext-pdo: *
- acdh-oeaw/arche-lib: ^7.6.1
- guzzlehttp/guzzle: ^7
- psr/log: ^3.0
- zozlak/guzzle-proxy-client: ^1.0
- zozlak/http-accept: ^1
- zozlak/logging: ^1
Requires (Dev)
This package is auto-updated.
Last update: 2026-07-17 17:57:39 UTC
README
Provides a framework for writing ARCHE Suite dissemination services.
Takes care of:
- Caching dissemination service responses.
- Fetching and caching repository resource metadata.
- Fetching and caching repository resource binaries.
- Checking aurhorization.
- Support of web standards like honoring
Cache-ControlandAccepted-EncodingHTTP request headers, emittingCache-ControlHTTP header, etc.
Basic use
<?php use Psr\Log\AbstractLogger; use acdhOeaw\arche\lib\RepoResourceInterface; use acdhOeaw\arche\lib\dissCache\Service; use acdhOeaw\arche\lib\dissCache\ResponseCache; use acdhOeaw\arche\lib\dissCache\ResponseCacheItem; class MyClass { static public method cacheHandler( RepositoryResourceInterface $res, array $serveRequestParam, CallbackContextInterface $contextObj, object $config ){ ...whatever needed... return new ResponseCacheItem($responseBody, $responseStatusCode, $responseHttpHeaders); } } $service = new Service('path_to_config.yaml'); $service->setCallback(fn($res, $param, $contextObj) => MyClass::cacheHandler($res, $param, $contextObj, $service->getConfig())); $resId = ...obtainResourceIdentifierFromTheRequest...; $param = [...readRequestParametersFromTheRequest...]; $response = $service->serveRequest($resId, $param); $response->send();
The sample YAML config file can be found in tests/config.yaml.
Getting access to the logger
$cache->getLog()
Getting acces to the repository resource binary content
$pathToFile = $cache->getFileCache()->getResourceBinaryPath($res);