OSCacheのJSPページバッファ技術


1ダウンロードアドレス
http://www.opensymphony.com/oscache/
2ダウンロードしたjarをあなたのbuild pathに追加します.tomcat/shared/libディレクトリの下に直接置くことをお勧めします
3 Web.xmlに構成を追加
表示
クリップボードにコピー
印刷
  
  •         oscache   

  •         /WEB-INF/classes/oscache.tld   
  •   
  •         <taglib>
                    <taglib-uri>oscache</taglib-uri>
                    <taglib-location>/WEB-INF/classes/oscache.tld</taglib-location>
            </taglib>

    4あなたのjspページに次のラベルを追加します.
    表示
    クリップボードにコピー
    印刷
    <%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache"%>  
    <%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache"%>

    5バッファが必要な部分には、次のラベルを使用します.
    表示
    クリップボードにコピー
    印刷
        
  •   

  • ... この中は君が緩衝しなければならない内容だ.  
  •   
  •  
    <cache:cache key="myPageCachekey" groups="myDefaultGroup" scope="application" time="1800">
    。。。            
    </cache:cache>
    

    6バッファのリフレッシュ
    表示
    クリップボードにコピー
    印刷
      
    <cache:flush scope="application" group="myDefaultGroup" />

    その中の
    key-[デフォルトはリクエストのrequest URI+query string]-
    The cache key, any string. This should be unique for the given scope since duplicate keys will map to the same cache entry. The default value uses an escaped version of the URI and query string of the current page.
    It is possible to specify multiple cache tags in the same page without specifying keys - in this situation an index is appended to the key of subsequent tags. However this usage is discouraged since if the flow of the page is inconsistent, or cache tags are nested, the indicies will potentially change each time the page is executed, resulting in seemingly jumbled cache entries.
    バッファされたkeyは、任意の文字列であってもよい.同じkeyが同じバッファ入口を表すため、1つの範囲内で唯一である.デフォルトでは、要求されたURIと要求された文字列(疑問符の後ろの部分)が使用されます.
    scope - [application] - The scope of this cache (valid values are "application"and "session").
    範囲、アプリケーションとセッションがあり、デフォルトはアプリケーション
    time - [3600] The amount of time to cache this content for (in seconds). (Default is 3600 seconds, one hour). Supplying a negative value for this attribute means that the content never expires.
    コンテンツをバッファリングする時間(秒).デフォルトは1時間、3600秒です.-1の場合、コンテンツは期限切れになりません.
    duration - [] - The duration of this cache (this attribute is an alternative to time). duration can be specified using Simple Date Format or ISO-8601 date format.
    もう1つのバッファ時間を設定する方法.簡単な日付フォーマットまたはISO-8601の日付フォーマットで使用できます
    cron - [] - A cron expression that determines when this cached content will expire. This allows content to be expired at particular dates and/or times, rather than once a cache entry reaches a certain age. See Cron Expressions to read more about this attribute.
    タイミングリフレッシュの設定.指定した時間とサイクルでリフレッシュできます.
    refresh - [false] - A boolean. If true, the cache will be refreshed regardless of whether it is considered stale or not. This enables you to decide at runtime whether or not to rebuild the content.
    強制リフレッシュ・バッファ
    mode - [] - Setting this to "silent"will prevent the body of the tag from being written to the output stream. This may be useful if you want to preload the cache with content without actually displaying that content to the user.
    [silent]に設定すると、コンテンツを事前に読み込むことができますが、出力されません.
    groups - [] - A comma-delimited list of group names can be provided. This allows cache entries to be grouped according to your needs. Grouping is useful when you have cached content that depends on other parts of your application or data - when that dependency changes, flushing the relevant group will cause all cache entries in that group to be expired.
    グループ化を設定します.リフレッシュなど、同じグループのバッファデータで制御できます.
    language - [] - The ISO-639 language code to distinguish different content cached under an otherwise identical key. This is useful on a multilingual site where the same JSP code is used to render content in different languages depending on the current user's preferences.
    言語、私は使ったことがなくて、問題も発見していません.現在のページの言語にデフォルト設定しましょう
    refreshpolicyclass - [] - A fully-qualified classname that extends com.opensymphony.oscache.web.WebEntryRefreshPolicy. This allows you to programmatically determine whether cached content should be exipired.
    カスタムリフレッシュポリシークラス.いつデータをリフレッシュするかを自分でコントロールする
    refreshpolicyparam - [] - Any arbitrary parameters that you need to pass through to the refreshpolicyclass. Specifying this attribute without specifying a refreshpolicyclass will have no effect.
    リフレッシュ・ポリシー・クラスに渡されるパラメータ