繁体   English   中英

PHP版本的ASP.NET的SqlCacheDependency

[英]PHP version of ASP.NET's SqlCacheDependency

我发现在编写C#ASP.NET应用程序时SqlCacheDependency非常有用,并且希望在我的PHP应用程序中使用类似的东西。 有人可以建议吗?

SqlCacheDependency永久缓存页面页面输出,直到在数据库中修改了指定的表为止。

这是ASP.NET中发生的情况的基本内容:

SqlCacheDependency SqlDep = null; 

// Check the Cache for the SqlSource key. 
// If it isn't there, create it with a dependency 
// on a SQL Server table using the SqlCacheDependency class. 
if (Cache["MyCache"] == null) { 
    SqlDep = new SqlCacheDependency("DatabaseName", "TableName"); 

    // Perform action to be cached ...
    var result = DatabaseIntensiveFunction();
    Cache.Insert("MyCache", result, SqlDep);
} 

else { 
    // The data was retrieved from the Cache.
}

// Output page from cache.
Output(Cache["MyCache"]);

有人知道MySql表依赖技术吗? -比基于时间的缓存干净得多。

为什么不为此使用MemcacheAPC之类的东西呢?

编辑:我也刚刚找到5.3.3的MySQLnd查询缓存插件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM