Priority: P1
Problem
InMemoryCacheStore validates TTL but forwards maxEntries and cleanupIntervalMs directly to overflow eviction and setInterval. NaN capacity disables eviction and non-positive or invalid intervals can create a hot timer.
Evidence
packages/cache-core/src/libs/InMemoryCacheStore.ts validates TTL while maxEntries flows to evictOverflow() and cleanupIntervalMs to setInterval() without equivalent validation.
Desired outcome
Cache resource bounds are valid before memory or timer resources are allocated.
Implementation path
- Add shared cache numeric validation and an InvalidCacheConfigurationProblem.
- Require positive safe-integer capacity and positive bounded timer delay.
- Cover zero, negatives, NaN, Infinity, fractions, and valid boundaries.
Acceptance criteria
- Invalid capacity or cleanup interval fails fast.
- A valid store retains current cleanup behavior.
- No invalid option can disable eviction or create a hot timer.
Validation
pnpm --filter @croco/cache-core test
Scope boundaries
Does not add a distributed cache adapter.
Priority: P1
Problem
InMemoryCacheStore validates TTL but forwards maxEntries and cleanupIntervalMs directly to overflow eviction and setInterval. NaN capacity disables eviction and non-positive or invalid intervals can create a hot timer.
Evidence
packages/cache-core/src/libs/InMemoryCacheStore.tsvalidates TTL whilemaxEntriesflows toevictOverflow()andcleanupIntervalMstosetInterval()without equivalent validation.Desired outcome
Cache resource bounds are valid before memory or timer resources are allocated.
Implementation path
Acceptance criteria
Validation
pnpm --filter @croco/cache-core testScope boundaries
Does not add a distributed cache adapter.