kaz         02/02/21 10:25:40

  Modified:    xdocs    UsingJCSBasicWeb.xml
  Log:
  Revised to illustrate that element attributes can now be specified in
  the configuration file.
  
  Revision  Changes    Path
  1.6       +29 -28    jakarta-turbine-stratum/xdocs/UsingJCSBasicWeb.xml
  
  Index: UsingJCSBasicWeb.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/xdocs/UsingJCSBasicWeb.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UsingJCSBasicWeb.xml      20 Feb 2002 17:26:57 -0000      1.5
  +++ UsingJCSBasicWeb.xml      21 Feb 2002 18:25:40 -0000      1.6
  @@ -244,21 +244,9 @@
                   // bookCache.put( "BookVObj" + id, vObj );
                   // or specify special characteristics
       
  -                // get the default attributes and copy them,
  -                // then make changes to specific values
  -    
  -                IElementAttributes attr = 
  -                        bookCache.getElementAttributes().copy();
  -    
  -                attr.setIsEternal(false);
  -    
  -                // expire after an hour
  -    
  -                attr.setMaxLifeSeconds(60 * 120);
  -    
  -                // put to cache with custom attributes
  -    
  -                bookCache.put("BookVObj" + id, vObj, attr);
  +                // put to cache 
  +
  +                bookCache.put("BookVObj" + id, vObj);
               }
       
           } 
  @@ -292,16 +280,9 @@
                   bookCache.remove("BookVObj" + vObj.bookID);
               }
       
  -            // get the default attributes, copy, and modify
  -    
  -            IElementAttributes attr = 
  -                    bookCache.getElementAttributes().copy();
  -            attr.setIsEternal(false);
  -            attr.setMaxLifeSeconds(60 * 120);
  -    
               // put the new object in the cache
       
  -            bookCache.put("BookVObj" + id, vObj, attr);
  +            bookCache.put("BookVObj" + id, vObj);
           } 
           catch (Exception e) 
           {
  @@ -311,10 +292,14 @@
   }
           ]]></source>
           <p>
  -          We now have the basic infrastructure for caching the book
  -          data.  I added auto expiration to the elements to be safe, so
  -          the rest of the work will be to configure the cache region.  
  -        </p>
  +          As elements are placed in the cache via <code>put</code>, it
  +          is possible to specify custom attributes for those elements
  +          such as its maximum lifetime in the cache, whether or not it
  +          can be spooled to disk, etc.  It is also possible (and easier)
  +          to define these attributes in the configuration file as
  +          demonstrated later.  We now have the basic infrastructure for
  +          caching the book data.  
  +      </p>
         </subsection>
         <subsection name="Selecting the appropriate auxiliary caches">
           <p>
  @@ -323,7 +308,11 @@
             would create a region that could store a bit over the minimum
             number I want to have in memory, so the core items always
             readily available.  I would set the maximum memory size to
  -          <code>1200</code>.
  +          <code>1200</code>.  In addition, I might want to have all
  +          objects in this cache region expire after <code>7200</code>
  +          seconds.  This can be configured in the element attributes on
  +          a default or per-region basis as illustrated in the
  +          configuration file below.
           </p>
           <p>
             For most cache regions you will want to use a disk
  @@ -367,6 +356,12 @@
   jcs.default.cacheattributes.MaxObjects=1000
   jcs.default.cacheattributes.MemoryCacheName=
       org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
  +jcs.default.elementattributes.IsEternal=false
  +jcs.default.elementattributes.MaxLifeSeconds=3600
  +jcs.default.elementattributes.IdleTime=1800
  +jcs.default.elementattributes.IsSpool=true
  +jcs.default.elementattributes.IsRemote=true
  +jcs.default.elementattributes.IsLateral=true
   
   # SYSTEM CACHE
   
  @@ -387,6 +382,12 @@
   jcs.region.bookCache.cacheattributes.MaxObjects=1200
   jcs.region.bookCache.cacheattributes.MemoryCacheName=
       org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
  +jcs.region.bookCache.elementattributes.IsEternal=false
  +jcs.region.bookCache.elementattributes.MaxLifeSeconds=7200
  +jcs.region.bookCache.elementattributes.IdleTime=1800
  +jcs.region.bookCache.elementattributes.IsSpool=true
  +jcs.region.bookCache.elementattributes.IsRemote=true
  +jcs.region.bookCache.elementattributes.IsLateral=true
   
   # AUXILIARY CACHES AVAILABLE 
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to