Download the PHP package andydefer/jsonl-cache without Composer
On this page you can find all versions of the php package andydefer/jsonl-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andydefer/jsonl-cache
More information about andydefer/jsonl-cache
Files in andydefer/jsonl-cache
Package jsonl-cache
Short Description PSR-16 compatible JSONL-based cache system with key-based path strategy
License MIT
Informations about the package jsonl-cache
JSONL Cache
Un système de cache persistant compatible PSR-16 basé sur des fichiers JSONL pour PHP 8.1+
Table des matières
- Introduction
- Installation
- Configuration
- Concepts fondamentaux
- Utilisation de base
- Opérations avancées
- Gestion du TTL
- Intégration Laravel
- Tests
- Architecture technique
- Référence technique
- Licence
Introduction
Le problème
Les caches traditionnels (Redis, Memcached, APC) sont performants mais nécessitent :
- Des services externes supplémentaires
- Une configuration complexe
- Une gestion mémoire spécifique
- Un déploiement particulier
La solution : JSONL Cache
JSONL Cache est un système de cache persistant basé sur des fichiers JSONL (JSON Lines), compatible avec l'interface PSR-16 (Common Interface for Caching Libraries).
| Problème | Solution JSONL Cache |
|---|---|
| Dépendance à Redis/Memcached | Stockage fichiers - 100% PHP |
| Configuration complexe | Zéro configuration, prêt à l'emploi |
| Perte de données au redémarrage | Persistance automatique |
| Pas de TTL natif | Support complet du Time To Live |
| Interface propriétaire | PSR-16 : changez de driver sans modifier votre code |
Installation
Pour Laravel, le package s'enregistre automatiquement via son Service Provider.
Publication de la configuration (Laravel)
Configuration
Fichier de configuration
Variables d'environnement
Concepts fondamentaux
Une entrée = un fichier JSONL
Structure d'un fichier cache
Organisation par hash MD5
| Niveau | Description | Exemple |
|---|---|---|
| 1 | Premier caractère du MD5 | e |
| 2 | Second caractère du MD5 | 1 |
| Fichier | Clé nettoyée | user_123.jsonl |
Pourquoi ? Éviter d'avoir trop de fichiers dans un même répertoire (limites du système de fichiers).
Utilisation de base
Instanciation du service
Sans Laravel :
Avec Laravel :
Stocker une valeur
Lire une valeur
Supprimer une valeur
Types de valeurs supportés
Opérations avancées
Opérations par lots (Multiple)
Accès aux données brutes
Écrasement automatique
La méthode set() écrase automatiquement la valeur existante :
Gestion du TTL
Différents formats de TTL
Comportement de l'expiration
TTL par défaut
La configuration default_ttl s'applique automatiquement :
Intégration Laravel
Service Provider
Le package enregistre automatiquement :
Exemple dans un contrôleur
Exemple dans un service
Tests
Tester le cache
Architecture technique
Composants principaux
| Composant | Rôle |
|---|---|
JsonlCacheService |
Service principal (implémentation PSR-16) |
CachePathStrategy |
Stratégie de chemin (organisation par hash MD5) |
CacheRecord |
DTO des données de cache |
JsonlService |
Service de lecture/écriture JSONL (package laravel-jsonl) |
JsonlCacheConfig |
Wrapper de configuration |
JsonlCacheInterface |
Interface PSR-16 étendue |
Dépendances
Flux d'exécution (set)
Flux d'exécution (get)
Référence technique
Services
| Service | Description | Documentation |
|---|---|---|
JsonlCacheService |
Service principal PSR-16 | Voir référence |
Stratégies
| Stratégie | Description | Documentation |
|---|---|---|
CachePathStrategy |
Organisation par hash MD5 | Voir référence |
Interfaces
| Interface | Description | Documentation |
|---|---|---|
JsonlCacheInterface |
PSR-16 + méthodes additionnelles | Voir référence |
Licence
MIT © Andy Defer
All versions of jsonl-cache with dependencies
laravel/framework Version ^12.0|^13.0|^14.0|^15.0
andydefer/laravel-jsonl Version ^0.8.17