Add ServerContextInterface for coroutine-safe request handling#172
Add ServerContextInterface for coroutine-safe request handling#172
Conversation
|
@coderabbitai review |
📝 WalkthroughWalkthroughUpdates CHANGELOG.md with a new version entry (1.15.0) documenting the introduction of ServerContextInterface for request handling in long-running server environments and the addition of RepositoryLoggerInterface with reset() method support. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Actions performedReview triggered.
|
Greptile OverviewGreptile SummaryThis PR adds version 1.15.0 release notes to the CHANGELOG documenting the Key changes documented:
The CHANGELOG entry follows Keep a Changelog format and accurately reflects the implementation from the earlier commits (ff919e8, 31485c2, 82fd020). Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant CacheInterceptor
participant ResourceStorage
participant ServerContext as ServerContextInterface
participant Cache as TagAwareAdapter
Note over Client,Cache: Traditional PHP-FPM Request (using GlobalServerContext)
Client->>CacheInterceptor: Resource Request
CacheInterceptor->>ResourceStorage: get(uri)
ResourceStorage->>ServerContext: has('X_VARY')
ServerContext->>$_SERVER: Check $_SERVER['X_VARY']
$_SERVER-->>ServerContext: true/false
ServerContext-->>ResourceStorage: boolean
alt X_VARY exists
ResourceStorage->>ResourceStorage: getVary()
ResourceStorage->>ServerContext: get('X_VARY')
ServerContext->>$_SERVER: Read $_SERVER['X_VARY']
$_SERVER-->>ServerContext: "user_agent,language"
ServerContext-->>ResourceStorage: "user_agent,language"
loop For each vary value
ResourceStorage->>ServerContext: get('X_USER_AGENT')
ServerContext->>$_SERVER: Read $_SERVER['X_USER_AGENT']
$_SERVER-->>ServerContext: "Mozilla/5.0..."
ServerContext-->>ResourceStorage: "Mozilla/5.0..."
end
ResourceStorage->>ResourceStorage: Build cache key with vary
else No X_VARY
ResourceStorage->>ResourceStorage: Build cache key without vary
end
ResourceStorage->>Cache: getItem(cacheKey)
Cache-->>ResourceStorage: ResourceState or null
ResourceStorage-->>CacheInterceptor: ResourceState or null
Note over Client,Cache: Coroutine Environment (Swoole/RoadRunner)
Note over ServerContext: Custom implementation uses<br/>request-scoped context instead of $_SERVER
|
Summary
ServerContextInterfaceandGlobalServerContextto abstract$_SERVERaccess for coroutine-safe environments (Swoole, RoadRunner, ReactPHP)RepositoryLoggerInterfacewithreset()for long-running process supportServerContextInterfaceinQueryRepositoryModule, use it inResourceStorageTest plan
GlobalServerContextRepositoryLogger