Name
registerCacheResource() — 注册缓存资源
说明
void registerCacheResource(string name,
SmartyCacheResource resource_handler);
该函数可以在Smarty中注册一个自定义缓存资源。 参数name
_是继承于Smarty_CacheResource的缓存资源名称。 详情参见自定义缓存。
Note
在Smarty2中使用了callback回调函数来调用$cache_handler_func。 Smarty3用Smarty_CacheResource
模块来替代该回调方法。
Example 14.35. registerCacheResource()
- <?php
- $smarty->registerCacheResource('mysql', new Smarty_CacheResource_Mysql());
- ?>
参见 unregisterCacheResource()
和 自定义缓存。
原文: https://www.smarty.net/docs/zh_CN/api.register.cacheresource.tpl