Class ObjectCache<T>

java.lang.Object
io.nosqlbench.engine.api.templating.ObjectCache<T>
Type Parameters:
T - The type of object.
All Implemented Interfaces:
java.util.function.Function<java.lang.String,​T>

public class ObjectCache<T>
extends java.lang.Object
implements java.util.function.Function<java.lang.String,​T>
An object cache to memoize returned objects into a concurrent hash map by name. This is meant to be used when you want to lazily initialize an instance of something by name that is likely to be re-used over the lifetime of an owning object.
  • Constructor Summary

    Constructors
    Constructor Description
    ObjectCache​(java.util.function.Function<java.lang.String,​T> newInstanceFunction)  
  • Method Summary

    Modifier and Type Method Description
    T apply​(java.lang.String name)  

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Constructor Details

    • ObjectCache

      public ObjectCache​(java.util.function.Function<java.lang.String,​T> newInstanceFunction)
  • Method Details

    • apply

      public T apply​(java.lang.String name)
      Specified by:
      apply in interface java.util.function.Function<java.lang.String,​T>