Interface PreparedParamCache

All Known Implementing Classes:
MapPreparedParamCache

public interface PreparedParamCache

A contract that ensures the caching of prepared parameters (PreparedParameter). The parametric engine gets PreparedParameter objects based on name. It uses implementations of this interface for this purpose.

The cache implementation must be thread-safe .

The cache implementation must meet a "happen-before relationship" between threads for read and write operations. ie. MapPreparedParamCache is build on top of ConcurrentHashMap, so it meets happens-before rules.

Since:
1.0.0
Author:
Przemek Hertel
See Also:
  • Method Details

    • put

      void put(String paramName, PreparedParameter pp)
      Inserts a parameter pp under a key paramName.
      Parameters:
      paramName - unique parameter name, used as a key for a cache
      pp - parameter to be stored in a cache
    • get

      PreparedParameter get(String paramName)
      Returns a parameter with defined name paramName or null, if parameter does not exist.
      Parameters:
      paramName - name of parameter
      Returns:
      parameter from a cache
    • invalidate

      void invalidate(String paramName)
      Removes entry with given name.
      Parameters:
      paramName - name of parameter
    • invalidate

      void invalidate(int id)
      Removes entry with a given [id] from a cache
      Parameters:
      id - entry id
    • invalidate

      void invalidate()
      Invalidate all entries from a cache
    • list

      Returns all cache entries as snapshot. All modification to this snapshot will not modify cache state.
      Returns:
      all cache entries as snapshot