1

Apache 2.2 httpd サーバーの背後に、この種のサービスを備えた Java REST ベースのアプリケーションがあります。

GET /countries/canada

mod_mem_cacheを有効にして、これらのサービスを次のように高速化したいと思います。

CacheEnable mem /countries/*

ワイルドカードを使用することは可能ですか?
そうでない場合、それを行うための解決策は何ですか?

4

1 に答える 1

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  

そしてApacheは各応答を保存して提供します:

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 を使用して、デフォルトの動作をすべて無効にし、キャッシュを強制します!!!
それがあなたの要件であるかどうかを自問する必要があります。

于 2015-06-10T11:16:40.070 に答える