FileCassetteStore
Development-default store: never the right choice in production (an AKS pod’s filesystem disappears on restart/eviction/scale-down), but a zero-dependency default that makes the feature usable immediately.
Modeled on FileSessionPersistence’s pattern: directory created 0700 at construction (refusing to proceed rather than degrade permissions later), each write goes to a temp file in the same directory, chmod 0600, then renamed into place, so a reader never observes a partially written cassette.
Synopsis
Section titled “Synopsis”final class FileCassetteStore implements ListableCassetteStoreInterface
| Implements | ListableCassetteStoreInterface |
| Source | Store/FileCassetteStore.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(string $directory, CassetteCodec $codec = new CassetteCodec(…)): mixed
| Parameter | Type | Description |
|---|---|---|
$directory | string | |
$codec | CassetteCodec |
Returns mixed
| Throws | When |
|---|---|
StorageException | if the directory is empty, is relative with no core.app_dir to anchor it, sits inside the app’s public document root, cannot be created/written to, or already exists with permissions wider than the owner. |
Methods
Section titled “Methods”| Method | Description |
|---|---|
delete(CassetteId $id): void | Removes the cassette at $id. |
get(CassetteId $id): ?Cassette | Null when no cassette is stored under this id. |
has(CassetteId $id): bool | |
put(CassetteId $id, Cassette $cassette): void | |
slugs(): list<string> | Every cassette id currently in the store, for cassette:list — the file store’s stand-in for a real object-store listObjects(). |
delete()
Section titled “delete()”public function delete(CassetteId $id): void
Removes the cassette at $id.
Best-effort: an id that does not exist is not an error.
| Parameter | Type | Description |
|---|---|---|
$id | CassetteId |
public function get(CassetteId $id): ?Cassette
Null when no cassette is stored under this id.
| Parameter | Type | Description |
|---|---|---|
$id | CassetteId |
Returns ?Cassette
public function has(CassetteId $id): bool
| Parameter | Type | Description |
|---|---|---|
$id | CassetteId |
Returns bool
public function put(CassetteId $id, Cassette $cassette): void
| Parameter | Type | Description |
|---|---|---|
$id | CassetteId | |
$cassette | Cassette |
slugs()
Section titled “slugs()”public function slugs(): list<string>
Every cassette id currently in the store, for cassette:list — the file store’s stand-in for a real object-store listObjects().
Returns list``<``string``> — slugs, not raw ids — the file store never learns a cassette’s raw id without decoding it.