elipzis/laravel-cacheable-model
whereNull edge cases (PR #56) improves robustness for complex queries, addressing a potential gap in handling NULL conditions.Cacheable trait remains the primary integration point, with minimal configuration required. The whereNull fix reduces boilerplate for queries involving NULL checks.created, updated, and deleted events are unchanged, ensuring cache consistency. No breaking changes to invalidation logic.uniqueQueries and cacheKey() methods remain functional, with the whereNull fix improving key generation for edge cases.whereNull fix mitigates one edge case, but complex queries (e.g., nested orWhere, whereDoesntHave) may still require explicit cacheKey() overrides.Laravel 11+ Migration:
PHP 8.5 Features:
Edge Case Coverage:
whereRaw, orWhereNull) that could benefit from similar fixes?NULL in composite keys (e.g., cacheKey() returning null)?Cache Driver Updates:
Cache::store() changes)?Deprecation Warnings:
increment() vs. update())?composer.json constraints allow Laravel 11:
"require": {
"laravel/framework": "^11.0",
"php": "^8.5"
}
redis:cluster) should be tested for cache consistency.whereNull optimizations).composer.json dependencies and run composer update.whereNull fix with models using whereNull queries (e.g., Model::whereNull('deleted_at')->get()).NULL checks.cacheKey() overrides for complex queries.config/cacheable.php to reflect Laravel 11’s cache driver defaults (if applicable).'driver' => env('CACHE_DRIVER', 'redis-cluster'),
'redis' => [
'cluster' => true,
'options' => [
'cluster' => 'redis',
'database' => 0,
],
],
whereNull fix is backward-compatible. No changes required for existing models using the trait.spatie/laravel-cache). Laravel 11’s updated service container may affect package initialization order.Cache::fake() in PHPUnit to mock cache behavior, including whereNull queries.assertDatabaseMissing()/assertDatabaseHas() for cache invalidation validation.composer require elipzis/laravel-cacheable-model:^0.6.0.php artisan vendor:publish --tag="cacheable-config"..env for Laravel 11’s cache driver (e.g., CACHE_DRIVER=redis-cluster).E_DEPRECATED for Laravel 10 deprecations).Cacheable trait to models as before. Test with whereNull queries first.use ElipZis\Cacheable\Models\Traits\Cacheable;
class User extends Model {
use Cacheable;
protected $cacheTTL = 3600;
}
whereNull queries:
$key = Cacheable::getCacheKey(User::whereNull('deleted_at')->get());
User::whereNull('deleted_at')->update(['active' => false]).uniqueQueries and cacheKey() for queries involving NULL or complex conditions.Cache::stats()).config/cacheable.php. Use Laravel 11’s environment-based configuration (e.g., config/laravel11.php) for environment-specific settings.composer require laravel/framework:^11.10 --dev
whereNull queries (e.g., model:query_hash:with_null_checks). Example:
users:whereNull_deleted_at:1634567890:3600
\ElipZis\Cacheable\Support\Facades\Cacheable::debug(true);
dd() helper or tap() for inspecting cache keys in whereNull queries.error_reporting(E_ALL & ~E_DEPRECATED) in .env.Cache::rememberForever() alternatives.try {
$users = User::whereNull('deleted_at')->cached();
} catch (\Exception $e) {
Sentry::captureException($e, [
'cache_key' => Cacheable::getCacheKey($users),
]);
}
How can I help you explore Laravel packages today?