com.opensymphony.xwork2.ognl

## Class DefaultOgnlCacheFactory<Key,Value>

- java.lang.Object
- - com.opensymphony.xwork2.ognl.DefaultOgnlCacheFactory<Key,Value>

- Type Parameters:
    `Key` - The type for the cache key entries
    `Value` - The type for the cache value entries
  All Implemented Interfaces:
    OgnlCacheFactory<Key,Value>
  Direct Known Subclasses:
    DefaultOgnlBeanInfoCacheFactory, DefaultOgnlExpressionCacheFactory, StrutsProxyCacheFactory

      public class DefaultOgnlCacheFactory<Key,Value>
      extends Object
      implements OgnlCacheFactory<Key,Value>

  Default OGNL Cache factory implementation.

  Currently used for Expression cache and BeanInfo cache creation.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.opensymphony.xwork2.ognl.OgnlCacheFactory

      `OgnlCacheFactory.CacheType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultOgnlCacheFactory()` Deprecated. since 6.4.0, use `#DefaultOgnlCacheFactory(int, CacheType)`
    `DefaultOgnlCacheFactory(int cacheMaxSize, OgnlCacheFactory.CacheType defaultCacheType)`
    `DefaultOgnlCacheFactory(int cacheMaxSize, OgnlCacheFactory.CacheType defaultCacheType, int initialCapacity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `OgnlCache<Key,Value>` | `buildOgnlCache()`
    `OgnlCache<Key,Value>` | `buildOgnlCache(int evictionLimit, int initialCapacity, float loadFactor, OgnlCacheFactory.CacheType cacheType)`
    `int` | `getCacheMaxSize()`
    `OgnlCacheFactory.CacheType` | `getDefaultCacheType()`
    `protected void` | `setCacheMaxSize(String maxSize)` Deprecated. since 6.4.0
    `protected void` | `setUseLRUCache(String useLRUMode)` Deprecated. since 6.4.0

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.opensymphony.xwork2.ognl.OgnlCacheFactory

      `buildOgnlCache, getUseLRUCache`

- - ### Constructor Detail

    - #### DefaultOgnlCacheFactory

          @Deprecated
          public DefaultOgnlCacheFactory()

      Deprecated. since 6.4.0, use `#DefaultOgnlCacheFactory(int, CacheType)`

    - #### DefaultOgnlCacheFactory

          public DefaultOgnlCacheFactory(int cacheMaxSize,
                                         OgnlCacheFactory.CacheType defaultCacheType)

    - #### DefaultOgnlCacheFactory

          public DefaultOgnlCacheFactory(int cacheMaxSize,
                                         OgnlCacheFactory.CacheType defaultCacheType,
                                         int initialCapacity)

  - ### Method Detail

    - #### buildOgnlCache

          public OgnlCache<Key,Value> buildOgnlCache()

      Specified by:
        `buildOgnlCache` in interface `OgnlCacheFactory<Key,Value>`

    - #### buildOgnlCache

          public OgnlCache<Key,Value> buildOgnlCache(int evictionLimit,
                                                     int initialCapacity,
                                                     float loadFactor,
                                                     OgnlCacheFactory.CacheType cacheType)

      Specified by:
        `buildOgnlCache` in interface `OgnlCacheFactory<Key,Value>`
      Parameters:
        `evictionLimit` - maximum capacity of the cache where applicable for cache type chosen
        `initialCapacity` - initial capacity of the cache where applicable for cache type chosen
        `loadFactor` - load factor of the cache where applicable for cache type chosen
        `cacheType` - type of cache to build
      Returns:
        a new cache instance

    - #### getCacheMaxSize

          public int getCacheMaxSize()

      Specified by:
        `getCacheMaxSize` in interface `OgnlCacheFactory<Key,Value>`

    - #### setCacheMaxSize

          @Deprecated
          protected void setCacheMaxSize(String maxSize)

      Deprecated. since 6.4.0

    - #### getDefaultCacheType

          public OgnlCacheFactory.CacheType getDefaultCacheType()

      Specified by:
        `getDefaultCacheType` in interface `OgnlCacheFactory<Key,Value>`

    - #### setUseLRUCache

          @Deprecated
          protected void setUseLRUCache(String useLRUMode)

      Deprecated. since 6.4.0
      No effect when `useLRUMode` is `false`

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.