InMemoryCacheImpl

org.eso.ias.utils.pcache.impl.InMemoryCacheImpl
class InMemoryCacheImpl(val maxSize: Integer, maxMemSize: Integer) extends InMemoryCache

The in memory cache that delegates to HashMap

This class is not thread safe.

Value parameters

maxMemSize

The max size of memory (MBytes) that can be used by the object in memory

maxSize

The max number of items to keep in memory

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

case class CacheObj(memSize: Long, timestamp: Long, jsonStr: String)

The objects stored in cache with:

The objects stored in cache with:

  • The memory used to store the object
  • Timestamp of last update
  • The JSON string representing the object

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

override def clear(): Unit

Empty the cache

Empty the cache

Attributes

Definition Classes
override def del(key: String): Boolean

Remove an object from the cache

Remove an object from the cache

Value parameters

key

The key of the object to remove

Attributes

Returns

True if the object has been removed, False otherwise (for example the object was not in the cache)

Definition Classes
override def get(key: String): Option[String]

Get an object from the cache

Get an object from the cache

Value parameters

key

The unique key to identify the object

Attributes

Returns

The Object in the cache if it exists, empty otherwise

Definition Classes
override def keySet: Set[String]

Collects all keys of this map in a set

Collects all keys of this map in a set

Attributes

Definition Classes
override def put(key: String, value: String): Boolean

Puts/update a value in the cache

Puts/update a value in the cache

Value parameters

key

The unique key to identify the object

value

: The string to store in the cache

Attributes

Returns

true if the object has been stored in the cache, false otherwise

Definition Classes
def size: Int

Attributes

Returns

the number of objects in this cache (both in memory and persisted)

Concrete fields

val cache: Map[String, CacheObj]

The actual cache

The actual cache

Attributes

val maxMemSizeBytes: Int
val maxSize: Integer
var memSize: Long

The size in memory of the objects stored in cache

The size in memory of the objects stored in cache

Attributes