Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `#[Cacheable]`'s `expirySecond` is documented as `non-negative-int`, so PHPStan and Psalm report a negative literal; a negative value is stored as no lifetime.
- The classes in `src-deprecated/` and `src-annotation-deprecated/` are kept as they were in 1.20.2 and are no longer maintained; `StorageRedisCacheProvider`, `StorageMemcachedCacheProvider`, `NamespacedCacheProvider` and `ResourceStorageCacheableTrait` no longer work, as the qualifiers and classes they use are removed. `RepositoryLoggerInterface` is still bound to `RepositoryLogger` and receives no cache event; read the log from `SemanticLoggerInterface` with `#[CacheLog]`.
- Requires `bear/resource` 1.36 or later: a donut hole's links are carried in its `toUri()` fragment.
- `ServerContextInterface` extends BEAR.Sunday's `ServerContextInterface`. Requires `bear/sunday` 1.10 or later.
- **Behaviour change**: on a `#[CacheableResponse]` or `#[DonutCache]` page, `CacheDependencyInterface::depends()` called from a template while it renders no longer tags the stored template (as before 1.20.0), so purging that child leaves the page's old content in the template. Embed such a part at the top level of the page body instead, with `#[Embed]` or an interceptor that puts the request there.
- **Behaviour change**: an embedded child that ran with a body is a dependency of its parent even without a cache attribute, an ETag or a `Surrogate-Key`: its URI tag and group tag go into the parent's stored tags and `Surrogate-Key`, so a write to it invalidates the parent. A hole on a `#[CacheableResponse]`/`#[DonutCache]` page still has no body when the page is stored and does not reach the stored template.
- **Behaviour change**: a write (`onPut`/`onPost`/`onPatch`/`onDelete`) on a resource with neither `#[Cacheable]` nor `#[CacheableResponse]` invalidates its own key, as `#[Purge]` of itself would, together with what its `#[Purge]`/`#[Refresh]` name; a write method marked `#[CacheableResponse]` or `#[RefreshCache]` leaves its own key to the refresh that attribute makes. A write whose query lacks a parameter its `onGet()` requires, other than one `#[ResourceParam]` binds, skips its own key and logs `purge_skipped`. Its own key is that of the URI the write was sent to. Such a write must return a resource object; one that returns another value now throws `ReturnValueIsNotResourceObjectException` after it has run.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"php": "^8.2",
"ext-zlib": "*",
"bear/resource": "^1.36",
"bear/sunday": "^1.5",
"bear/sunday": "^1.10",
"koriym/semantic-logger": "^0.11.1",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"psr/log": "^2.0 || ^3.0",
Expand Down
28 changes: 4 additions & 24 deletions src/ServerContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,10 @@

namespace BEAR\QueryRepository;

/**
* Provides access to server context in a thread-safe manner
*
* This interface abstracts access to request context (like $_SERVER) to support
* concurrent request processing in environments like Swoole, RoadRunner, and ReactPHP.
*
* For traditional PHP-FPM: Use GlobalServerContext (default)
* For Swoole/RoadRunner: Implement with request-scoped context
*/
interface ServerContextInterface
{
/**
* Get a value from the server context
*
* @param string $key The key to retrieve (e.g., 'HTTP_USER_AGENT', 'X_VARY')
*
* @return string|null The value or null if not set
*/
public function get(string $key): string|null;
use BEAR\Sunday\Extension\Server\ServerContextInterface as SundayServerContextInterface;

/**
* Check if a key exists in the server context
*
* @param string $key The key to check
*/
interface ServerContextInterface extends SundayServerContextInterface
{
/** Whether the key exists in the server context */
public function has(string $key): bool;
}
Loading