Static caching
' Html_path ' cache directory, which is a constant is not a configuration item, defined in the portal file
' html_cache_on ' = = True, //Turn on static cache
' Html_cache_time ' + 3600, //global static cache lifetime (seconds)
' Html_file_suffix ' = '. HTML ', //Set static cache file suffix
' html_cache_rules ' = = Array ( //define static cache rules
Define the entire article controller
' article: ' = ' = ' article/{:action}_{id} ',
To cache a product
' product:plist ' = ' product/plist_{id}_{pid} ',
To cache a single operation
' Index:index ' = ' index/index ',
' Product:category ' =>array (' Product/category ', 0),
),
//------------------------------------------------------------
---------------------data cache (Universal cache)--------------------
Query cache, Fast cache
Data caching
Cached files in Runtime/temp
' Data_cache_type ' = ' File ',
' Data_cache_prefix ' = ' kangku_ ',
' data_cache_time ' =
//------------------------------------------------------------
-----------------------Fast Cache-----------------------------
Persistent cache
Cache data
F (' data ', $Data);
Specify directory default Data_path
F (' Data ', $Data, Temp_path);
Delete Cache
F (' data ', NULL);
//------------------------------------------------------------
-----------------------Query Cache-----------------------------
Cache at query time
Add the cache (true) after the first query and then take the value from the cached data, no other judgment
1. Default cache
$Model->cache (True)->where (' Status=1 ')->select ();
2. Give the cache a name that can be read
$Model->cache (' Cache_name ')->select ();
Read value
$value = S (' Cache_name ');
3. Set the cache mode and time
$Model->cache (true,60, ' file ')->select ();
//------------------------------------------------------------
--------------------SQL parsing Cache-----------------------------
Turn on caching
' Db_sql_build_cache ' = true,
Cache mode
' Db_sql_build_queue ' = ' file ',
Queue Length for SQL cache
' Db_sql_build_length ' = 20,
thinkphp static cache, data cache, fast cache, query cache