Zend Cacheで異なるhttpメソッドを区別するにはどうすればよいですか?
現在、たとえばGET呼び出しを行うと、キャッシュされ、もちろん後で高速に動作しますが、同じURIの後にPOST呼び出しを行うと、このURIで最後にキャッシュされたGETからのデータが返されます。
したがって、基本的には、キャッシュされたアイテムのIDとしてURIを使用しますが、呼び出しのタイプは使用しないと思います。この状況で何をしますか?結果をキャッシュしようとするrestfullクライアントがあります。
protected function _initCache()
{
$dir = APPLICATION_PATH .'/../public/tmp/cache/' ;
$frontendOptions = array(
'lifetime' => 10,
'content_type_memorization' => true,
'default_options' => array(
'cache' => true,
'cache_with_get_variables' => true,
'cache_with_post_variables' => true,
'cache_with_session_variables' => true,
'cache_with_cookie_variables' => false,
'automatic_cleaning_factor' => 0,
),
'regexps' => array(
'^/api/' => array('cache' => true),
'^/api2/' => array('cache' => true),
)
);
$backendOptions = array(
'cache_dir' =>$dir,
'hashed_directory_level' => 1
);
$cache = Zend_Cache::factory('Page',
'File',
$frontendOptions,
$backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
Zend_Registry::set('Cache', $cache);
}