AbstractCache

Abstract cache class used to provide common cache functionality

Inherits: IConfigurable, ICache, IReferenceable, IOpenable

Description

The AbstractCache class is used to provide common cache functionality.

Properties

Timeout

Gets or sets the timeout.

public long Timeout { get; set; }

Instance methods

CloseAsync

Configures component by passing configuration parameters.

public virtual Task CloseAsync(IContext context)

  • context: IContext - (optional) a context to trace execution through a call chain.

Configure

Parameterized configuration template given as string with dynamic parameters.

public virtual void Configure(ConfigParams config)

IsOpen

Checks if the component is opened

public virtual bool IsOpen()

  • returns: bool - true if is opened and false otherwise.

OpenAsync

Opens the component and establishes connections to services

public virtual Task OpenAsync(IContext context)

  • context: IContext - (optional) a context to trace execution through a call chain

SetReferences

Sets the references.

public virtual void SetReferences(IReferences references)

Abstract methods

RemoveAsync

Removes an object from the cache.

public abstract Task RemoveAsync(IContext context, string key)

  • context: IContext - (optional) a context to trace execution through a call chain
  • key: string - unique key identifying the object.

RemoveAsync

Retrieves a value from cache by a unique key.

public abstract Task<T> RemoveAsync<T>(IContext context, string key)

  • context: IContext - (optional) a context to trace execution through a call chain
  • key: string - unique key identifying the object.
  • returns: Task<T> - cached value or null if the value is not found.

StoreAsync

Stores an object identified by a unique key in cache.

public abstract Task<T> StoreAsync<T>(IContext context, string key, T value, long timeout)

  • context: IContext - (optional) a context to trace execution through a call chain.
  • key: string - unique key identifying a data object.
  • value: T - data object to store.
  • timeout: long - time to live for the object in milliseconds.
  • returns: Task<T> - Ccched value or null if the value is not stored.

See also