symfony/ai-cache-store
Symfony AI Cache Store integrates Symfony Cache with Symfony AI Store, letting you use a cache backend as a vector store for AI applications. It provides a lightweight bridge for storing and retrieving embeddings through familiar cache infrastructure.
count() support makes step 2 cheaper to instrument: corpus size becomes a first-class, queryable metric rather than something we estimate from write logs.remove(), and v0.14.0 adds count() for metadata-scoped retrieval, cache invalidation, and corpus telemetry.count() lets us assert corpus size before an O(n) scan and fall back to a cheaper path (metadata filter, keyword lookup, or a queued job) when a threshold is crossed — a guardrail, not just a dashboard.k. Nothing in v0.14.0 changes this — there is still no ANN index.Adopt if all of the following hold:
symfony/ai) as the AI abstraction layer. This repo is a thin bridge inside the Symfony AI monorepo — its README is five lines and points to the parent project for issues and PRs. The real evaluation is of symfony/ai, not this package.flush will silently delete vectors. Confirm the data is derived (re-computable from source) rather than authoritative.Look elsewhere if:
symfony/ai, binding a StoreFactory/CacheStore into Laravel's container, and maintaining that glue yourself — with no Laravel-specific docs or examples. The integration tax is real and recurring.Gate before committing: run a two-day spike against a representative corpus. Measure insert throughput, p95 query latency at 10k / 100k vectors, serialization overhead in the chosen cache driver, and behavior under eviction. Additionally, benchmark count() on the target driver — it may be a cheap key count on some backends and a full scan on others; if it is expensive, keep it off request paths and use it only in scheduled telemetry. If p95 latency or memory exceeds the target at 10x current corpus size, stop and go straight to phase 3.
To executives (one paragraph): "We have a cheap way to test whether semantic search and AI-assisted features are worth investing in. This package lets the AI layer reuse the Redis cache we already pay for as a lightweight vector store, so a prototype costs engineering days instead of a new vendor contract and a new system to operate. The latest release adds corpus-size counting, which means we can put hard guardrails and cost telemetry around the pilot from week one instead of guessing. It also avoids locking us in: the same interface swaps to a dedicated vector database when volume justifies it. The trade-off is honest — it's early-stage, pre-1.0, and appropriate for prototypes and small corpora, not for high-traffic production search. I'm recommending a time-boxed pilot with explicit go/no-go thresholds, not a platform commitment."
To engineering (the important caveats):
StoreFactory / CacheStore binding in a service provider), a thin facade, and our own tests — there are no Laravel examples upstream.flush, TTL expiry, and LRU eviction delete vectors, and make every write idempotent and re-derivable.count() — but verify the driver implements it cheaply before trusting it in a hot path.VectorDocumentInterface. Use it as the swap seam: type our internal vector-store wrapper against that interface rather than the concrete cache store, so a move to pgvector or a managed store is a single-class change. Note this is an additive abstraction, not a stability guarantee — pre-1.0, expect it to move.symfony/ai repo, and keep vector-store usage behind an internal interface.count()), eviction count, and embedding spend avoided. Those numbers are what turn this pilot into either a production decision or a fast, cheap "no."To data/ML stakeholders: you get persistence, filtered retrieval, and now corpus counts for embeddings inside the PHP stack, which is enough to validate retrieval quality and prompt/embedding caching offline. You do not get ANN, re-ranking at scale, or a query planner — treat any quality evaluation here as directional, and expect to re-run it against the real index before we commit to a search product.
How can I help you explore Laravel packages today?