Skip to content

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.

final class FileCassetteStore implements ListableCassetteStoreInterface

ImplementsListableCassetteStoreInterface
SourceStore/FileCassetteStore.php

public function __construct(string $directory, CassetteCodec $codec = new CassetteCodec(…)): mixed

ParameterTypeDescription
$directorystring
$codecCassetteCodec

Returns mixed

ThrowsWhen
StorageExceptionif 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.
MethodDescription
delete(CassetteId $id): voidRemoves the cassette at $id.
get(CassetteId $id): ?CassetteNull 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().

public function delete(CassetteId $id): void

Removes the cassette at $id.

Best-effort: an id that does not exist is not an error.

ParameterTypeDescription
$idCassetteId

public function get(CassetteId $id): ?Cassette

Null when no cassette is stored under this id.

ParameterTypeDescription
$idCassetteId

Returns ?Cassette

public function has(CassetteId $id): bool

ParameterTypeDescription
$idCassetteId

Returns bool

public function put(CassetteId $id, Cassette $cassette): void

ParameterTypeDescription
$idCassetteId
$cassetteCassette

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.