8000 add cache driver configuration by dimzeta · Pull Request #25 · Blaspsoft/blasp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add cache driver configuration #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dimzeta
Copy link
@dimzeta dimzeta commented Apr 4, 2025

Add custom cache driver support

Description

This PR adds the ability to specify a custom cache driver for Blasp. By default, the package uses Laravel's default cache driver, but now users can configure a specific driver via config or environment variable.

This is particularly useful in environments like Laravel Vapor where the default cache uses DynamoDB, which has a "maximum allowed size" limit that can be hit when caching profanity expressions. With this PR, users can switch to a different cache driver (like Redis) to avoid these limitations.

Changes

  • Added cache_driver config option
  • Added BLASP_CACHE_DRIVER env variable support
  • Refactored BlaspCache trait to use a static getCache() method
  • Added unit tests for cache functionality
  • Updated README with cache configuration documentation

Example

// In .env
BLASP_CACHE_DRIVER=redis

Tests

Added unit tests to verify cache driver selection, cache clearing, and key tracking functionality.

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
0