OSCache feature

1、Fast in-memory caching
         OSCache allows you to store dynamic content (eg for 30 minutes) in memory. Each further request is served directly from the memory cache, resulting in dramatic speed increases.
         可以使用OSCache把动态的内容寄存到内存中,以增加客户段请求的响应速度.这些被寄存在内存中的内容在一定的时间段内保持不变(比如 30分钟).
     
        The cache is keyed programmatically. This means you can calculate a cache key that works for your situation. For example an ecommerce site might use product ID as keys, or content site might use an article date and article ID combination. 
       就象我们使用数据库时的情形:可以通过产品的ID来得到对应的产品,或者通过文章的ID和日期这一复合主键得到它对应的内容一样.OScache提供了使用主键来访问缓存的手段,我们一样可以使用单一主键或者复合主键得到被缓存的内容.
      
       The cache is stored in standard scopes that any JSP programmer is familiar with (application or session). The session scope allows you to have different cached content per user. This is one unlike any other caching system we've ever seen.
       如果你是一个Web编程人员,相信对application,session,request等都不会陌生,OSCache可以把这些概念有效的使用到缓存上面,以达到和web的完美结合,比如如果缓存被使用在session级别上面,则不同的两个用户,使用的换存数据就是独立的.

2、Persistent on-disk caching
      OSCache can also write the cache to disk. This provides caching across server restarts, and caching of datasets that do not fit into memory. Caching can be configured to use memory or file caching, or a combination of both.
      OSCache可以把缓存的内容写入到硬盘,这样可以来面对服务重启后内存数据的丢失问题。我们可以通过配置来把缓存的内容放置到memory或者file,甚至同时使用两者.

      If you want to persist the cache to somewhere other than disk, you can plug in a custom PersistenceListener. This allows you to persist the cache to anywhere (for example to a database via JDBC or to LDAP via JNDI).
      我们也可以使用PersistenceListener来使得OSCache把缓存放置到除了disk以外的任何地方,比如使用JDBC把内容存储到数据库等。

      When using both disk caching and memory caching. It is possible to limit the cache size to avoid using too much memory but let disk cache unlimited, resulting in browser style complementary disk cache. When cached objects are removed from memory, they are still on disk. If the item is needed again and it is not expired the cache file will be used. This also gives fault tolerance if the server crashes.

      Persistence can also be switched to overflow mode using the property oscache.persistence.overflow.only. This changes the default behavior (of persisting every cache entry when there is a listener) to only persist when the memory cache capacity has been reached.

3、Excellent Performance
      Written with performance in mind.
     
      Mulitple cache requests can be handled concurrently.
    
      Only one requesting thread needs to update an expired cache entry even if multiple threads are requesting it simultaneously. Other threads can be configured to either receive the recently-expired object, or block until the cached object is updated. Similarly, when a new entry is being added to the cache, other threads requesting that entry will block until it is ready rather than run off and race to build the same object. In a high load environment this can provide enormous performance benefits.
 
      Automatically takes advantage of JRE 1.4 or higher if available.

4、Clustering support
     OSCache can easily be configured to cluster across multiple boxes. This provides both scalability and failover support without any changes required in your caching code.

5、Flexible Caching System
      OSCache allows you to cache portions of JSP pages, arbitrary Java objects, and even entire servlet responses.

      Cache capacity can be set allowing you to limit the number of cached objects.
     
       Multiple caching algorithms are supported such as LRU (Least Recently Used), FIFO (First In First Out), or unlimited. It is also possible to plug in your own custom algorithm.
       You are given a huge amount of control over the way cached objects expire. Objects can be cached indefinitely, expired once they reach a certain age, or expired based on a cron expression. Programmatic flushing is also possible, and if that is still not enough pluggable RefreshPolicies allow custom refresh strategies. 

      Cached objects can be grouped together however you like, allowing for powerful management of cached data. This is an extremely useful feature that is far more powerful than what other caching solutions typically offer (such as the flushing of cache keys that match a particular pattern). 

      Fully event driven! OSCache fires events for various happenings 'under the hood' such as cache entry events (adding, updating, flushing and removing) and cache accesses (hit, stale hit and miss). It is easy to add your own event handlers. 

      Multiple caches can be created, each with their own unique configuration.

你可能感兴趣的:(编程,jsp,cache,jdbc,performance)