Understand default cache behavior in EasyWeChat 6.x
6.xIn EasyWeChat 6.x, application instances (e.g., OfficialAccount\Application, MiniApp\Application) use the InteractWithCache trait to provide a unified cache interface. By default, all caching uses the file system, with the path determined by the PHP temporary directory.
You can retrieve the current cache instance, lifetime, and namespace using the following methods:
getCache(): Returns the cache instance.getCacheLifetime(): Returns the cache lifetime in seconds (default is 1500).getCacheNamespace(): Returns the cache namespace (default is'easywechat').
use EasyWeChat\OfficialAccount\Application;
$app = new Application([
'app_id' => 'your-app-id',
'secret' => 'your-app-secret',
// ...
]);
// Get default cache instance
$cache = $app->getCache();
// Get default configuration
echo $app->getCacheLifetime(); // 1500 seconds
echo $app->getCacheNamespace(); // 'easywechat'