com.opensymphony.xwork2.ognl

## Interface OgnlCache<Key,Value>

- Type Parameters:
    `Key` - The type for the cache key entries
    `Value` - The type for the cache value entries
  All Known Implementing Classes:
    OgnlCaffeineCache, OgnlDefaultCache, OgnlLRUCache

      public interface OgnlCache<Key,Value>

  A basic cache interface for use with OGNL processing (such as Expression, BeanInfo). All OGNL caches will have an eviction limit, but setting an extremely high value can simulate an "effectively unlimited" cache.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `Value` | `get(Key key)`
    `int` | `getEvictionLimit()`
    `void` | `put(Key key, Value value)`
    `void` | `putIfAbsent(Key key, Value value)`
    `Value` | `remove(Key key)` Removes the mapping for the given key, if present.
    `void` | `setEvictionLimit(int cacheEvictionLimit)`
    `int` | `size()`

- - ### Method Detail

    - #### get

          Value get(Key key)

    - #### put

          void put(Key key,
                   Value value)

    - #### putIfAbsent

          void putIfAbsent(Key key,
                           Value value)

    - #### remove

          Value remove(Key key)

      Removes the mapping for the given key, if present.
      Parameters:
        `key` - the key to remove
      Returns:
        the previous value associated with the key, or `null` if none
      Since:
        6.11.0

    - #### size

          int size()

    - #### clear

          void clear()

    - #### getEvictionLimit

          int getEvictionLimit()

    - #### setEvictionLimit

          void setEvictionLimit(int cacheEvictionLimit)

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