by-nc-sa     개발자, DBA가 함께 만들어가는 오라클클럽 지식창고!

OSCache




OSCache

1. What is OSCache

  • OSCache는 JSP caching, Reqeust caching, DB Data caching등의 캐쉬 기능을 지원하는 framework입니다.
  • OSCache는 기본적으로 memory를 cache storage로 활용하고 하지만, persistence를 위해 disk를 활용할 수 도 있습니다.

2. 설치

3. OSCache 사용 예제

<cacheModel id="emp-cache" type="OSCACHE">
        <flushInterval minutes="60"/>
    </cacheModel>

    <select id="selectEmpList" parameterClass="int" resultClass="emp" cacheModel="emp-cache" >
        SELECT * FROM emp WHERE deptno=#deptno#
    </select>
  • POJO Caching
String myKey = "myKey";
String myValue;
int myRefreshPeriod = 1000;
try {
    // Get from the cache
    myValue = (String) admin.getFromCache(myKey, myRefreshPeriod);
} catch (NeedsRefreshException nre) {
    try {
        // Get the value (probably from the database)
        myValue = "This is the content retrieved.";
        // Store in the cache
        admin.putInCache(myKey, myValue);
    } catch (Exception ex) {
        // We have the current content if we want fail-over.
        myValue = (String) nre.getCacheContent();
        // It is essential that cancelUpdate is called if the
        // cached content is not rebuilt
        admin.cancelUpdate(myKey);
    }
}

문서에 대하여

  • 최초작성자 : 김정식
  • 최초작성일 : 2007년 11월 07일

문서정보

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.