2015-06-08 2 views
1

За Apache сервер 2,2 HTTPd, я отдыхаю на основе приложения Java с помощью этого вида услуг:Использование Apache mod_mem_cache кэшировать услуги Отдых

GET /countries/canada 

Я хотел бы включить mod_mem_cache ускорить эти таких услуг:

CacheEnable mem /countries/* 

Можно ли использовать подстановочные знаки?
Если нет, то какое есть решение?

ответ

1

На самом деле нам не нужен шаблон.

Например, если определенный следующую конфигурацию:

ProxyPass /jsontest/ http://echo.jsontest.com/ 
ProxyPassReverse /jsontest/ http://echo.jsontest.com/ 
<IfModule mod_cache.c> 
    <IfModule mod_mem_cache.c> 
     CacheEnable mem /jsontest/ 
     CacheDefaultExpire 300 
     MCacheSize 1024000 
     MCacheMaxObjectCount 10000 
     MCacheMinObjectSize 1 
     MCacheMaxObjectSize 2048000 
     CacheStorePrivate On 
     CacheIgnoreNoLastMod On 
     CacheStoreNoStore On 
     CacheIgnoreCacheControl On 
    </IfModule> 
</IfModule> 

Я могу запросить:

http://localhost/jsontest/ 

или

http://localhost/jsontest/titi/tutu 

и апач будет хранить каждую реакцию и служат им:

Incoming request is asking for an uncached version of /jsontest/, but we have been configured to ignore it and serve cached content anyway 
mem_cache: Cached url: http://localhost:80/jsontest/? 

Incoming request is asking for an uncached version of /jsontest/, but we have been configured to ignore it and serve cached content anyway 
mod_cache.c(312): cache: serving /jsontest/ 

Incoming request is asking for an uncached version of /jsontest/titi/tutu, but we have been configured to ignore it and serve cached content anyway 
mod_cache.c(753): cache: Caching url: /jsontest/titi/tutu 

Incoming request is asking for an uncached version of /jsontest/titi/tutu, but we have been configured to ignore it and serve cached content anyway 
mod_cache.c(312): cache: serving /jsontest/titi/tutu 

Будьте осторожны:

С CacheStorePrivate, CacheIgnoreNoLastMod, CacheStoreNoStore и CacheIgnoreCacheControl, я отключил все поведение по умолчанию и силы кэш !!!
Вы должны спросить себя, является ли это вашим требованием.