CCache
in package
Factory class for creating cache instances.
This class replaces the previous Singleton pattern. It reads the CACHE_DRIVER constant from the configuration to determine which cache implementation (e.g., CFileCache, CRedisCache) to instantiate.
This approach decouples the application from a specific cache implementation and is a step towards a full Dependency Injection container.
Table of Contents
Methods
- CreateInstance() : ICache|null
- Creates and returns a cache instance based on the configuration.
Methods
CreateInstance()
Creates and returns a cache instance based on the configuration.
public
static CreateInstance([string|null $domain_name = DOMAIN_NAME ][, string|null $app_name = APP_NAME ]) : ICache|null
Parameters
- $domain_name : string|null = DOMAIN_NAME
-
The domain name for cache isolation.
- $app_name : string|null = APP_NAME
-
The application name for cache isolation.
Return values
ICache|null —An object implementing the ICache interface, or null if caching is disabled or the driver is invalid.