Collections
Vectors are grouped into named collections. A collection is a regular Cache-Pot key whose type isvector. Within a collection, every vector must share the same dimension — the dimension is fixed the moment you insert the first vector with VSET, and any subsequent insert with a different number of floats returns an error.
Each vector entry has three components:
ID
A unique string identifier within the collection. Re-using an ID overwrites the existing vector.
Float32 array
The vector itself — a space-separated sequence of floating-point values passed directly in the command.
META (optional)
An arbitrary string attached to the vector, such as a document title, URL, or serialised JSON payload.
Commands
Example workflow — document similarity search
1
Store document embeddings
Insert vectors with descriptive metadata. This example uses 4-dimensional vectors for readability; real embeddings typically have 768–3072 dimensions.
2
Search for the most similar document
Pass a query vector and request the top-2 results with scores.
3
Inspect collection stats
Using with an embedding model
In a real application, you convert text to vectors using an embedding model before callingVSET or VSEARCH. The example below uses the openai Python library with Cache-Pot’s standard Redis wire protocol.
Cosine similarity scoring
The score returned byVSEARCH is the cosine similarity between the query vector and each stored vector, in the range [-1, 1]:
Cache-Pot picks the search strategy automatically per collection. Collections up to 256 vectors use exact flat (brute-force) cosine similarity — every vector is compared against the query, so results are always exact. Past that size, an HNSW (Hierarchical Navigable Small World) graph index takes over: query time becomes sub-linear instead of linear, at the cost of approximate rather than exact results. In testing, HNSW returns 100% of the same top-10 neighbours as brute force while running several times faster on collections in the low thousands of vectors — and the speed gap widens as collections grow.
VSET, VSEARCH, and every other command behave identically either way.