在编写C#ASP.NET应用程序时,我发现SQLCACHEDEPTINCY非常有用,并且很想在我的PHP应用程序中使用类似的东西。谁能建议什么?

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

这是ASP.NET中发生的事情的基本JIST:

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表依赖技术吗? - 比基于时间的缓存更干净。

有帮助吗?

解决方案

为什么不使用类似的东西 memcache 或者 APC 为了这?

编辑:我也发现 mysqlnd查询缓存 5.3.3的插件。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top