2010-11-30 68 views
0

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

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

下面是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表依赖技术的? - 比基于时间的缓存更清洁。

回答