﻿# Semantic answer caches need permission filters on every lookup

Equivalent questions can have different permitted evidence. Define trusted cache scope, required lookup filters and eligibility changes after access updates.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/enterprise-ai-semantic-cache-permission-filter/
Language: en

## Ask the same question under different permissions

An employee and a contractor ask an enterprise assistant for the current project contact. Their wording is equivalent, but their permitted evidence differs. A semantic cache may recognize the questions as similar and return an earlier answer without another retrieval. The cache therefore needs an eligibility boundary independent of similarity. The engineering question is which authenticated scope must match before a stored response can become a candidate for reuse.

## Use filterable fields as an explicit contract

The [RedisVL caching guide](https://redis.io/docs/latest/develop/ai/redisvl/user_guide/how_to_guides/llmcache/) demonstrates custom filterable fields for separating users' cached responses. Entries receive filter values when stored, and lookups supply a filter expression. For this deployment, derive those values from trusted application identity and permission state. A user identifier mentioned inside the prompt must not become the authority for choosing another user's cache partition.

## Apply the boundary on every lookup path

The [SemanticCache API reference](https://redis.io/docs/latest/develop/ai/redisvl/api/cache/) describes filter_expression as optional; without it, the full cache is searched. Creating a filterable field alone therefore does not enforce the application's intended restriction. Inventory synchronous, asynchronous and fallback lookup paths. Place scope construction in a controlled wrapper so an omitted argument cannot silently broaden retrieval. The wrapper is an application design choice, not an automatic property of every RedisVL integration.

## Define what changes invalidate eligibility

User identity may be insufficient when group membership or document access changes. A proposed scope record can include a permission revision or another application-controlled eligibility version. Define how that value changes and how obsolete entries become unusable. Cache lifetime controls retention, while permission validity controls whether an entry may serve this caller now. They are different rules. Avoid claiming that a short expiration period alone implements immediate revocation across cached answers.

## Exercise misleadingly similar requests

Store harmless fixture answers for permitted scopes with intentionally similar questions and visibly different test facts. Query each through the actual application path, then remove permission and repeat with the changed scope revision. Include a missing-scope request and a fallback path that encounters a cache error. Acceptance evidence identifies the selected entry, applied trusted filter and whether reuse was denied when eligibility changed. No Redis benchmark or successful isolation experiment was performed for this article; these are proposed integration checks.

## Keep response reuse separate from model-state reuse

[Persistent KV invalidation](/journal/persistent-kv-cache-invalidation/) concerns computed model state and model or tokenizer compatibility. Here the reused object is a completed answer whose evidence has an access boundary. [Tenant routing](/journal/milvus-partition-key-tenant-query-boundary/) provides related context about trusted query scope. A valid semantic hit still needs eligibility and factual freshness; it does not prove that the stored answer remains correct. Report the cache partition policy and observed lookup paths without claiming that semantic similarity supplies authorization or that every organizational permission can safely share one user label.
