Skip to content

Improve CacheStore correctness, add cache() helper#263

Merged
techmahedy merged 4 commits intodoppar:3.xfrom
techmahedy:techmahedy-3.x
Apr 28, 2026
Merged

Improve CacheStore correctness, add cache() helper#263
techmahedy merged 4 commits intodoppar:3.xfrom
techmahedy:techmahedy-3.x

Conversation

@techmahedy
Copy link
Copy Markdown
Member

This PR strengthens Doppar’s cache layer, adds a new cache() helper.

What Changed

Caching implementation:

  • tightened CacheStore key validation and iterable handling
  • made clear() namespace/prefix-scoped instead of clearing unrelated cache entries
  • improved stash() and stashForever() so cached null values are treated as valid hits
  • added synchronized mutation paths for add(), increment(), and decrement()
  • introduced IncrementableCacheInterface to make the rate limiter depend on the methods it actually uses
  • updated RateLimiter to use add()/increment() more safely and predictably
  • registered the new cache contract in the cache service provider

Helpers:

  • added global cache() helper support for:
  • cache() to resolve the cache store
  • cache('key', $default) to read values
  • cache(['key' => 'value'], $ttl) to write values
  • cache()->... object-style chaining

Tests:

expanded cache tests for:

  • traversable inputs in bulk operations
  • prefix-scoped clearing
  • cached null behavior in stash helpers
  • stricter key validation
  • helper usage

@techmahedy techmahedy merged commit 10c2ec7 into doppar:3.x Apr 28, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant