# ICacheService

```csharp
/// <summary>
/// Common cache provider interface
/// </summary>
public interface ICacheService
{
    /// <summary>
    /// Gets cache value
    /// </summary>
    /// <typeparam name="T">The type of result object</typeparam>
    /// <param name="cacheKey">Cache key</param>
    /// <returns>Object</returns>
    T Get<T>(string cacheKey);
    
    /// <summary>
    /// Gets cache value asynchronous
    /// </summary>
    /// <typeparam name="T">The type of result object</typeparam>
    /// <param name="cacheKey">Cache key</param>
    /// <returns>Object</returns>
    Task<T> GetAsync<T>(string cacheKey);
    
    /// <summary>
    /// Sets cache value asynchronous
    /// </summary>
    /// <typeparam name="T">The type of source object</typeparam>
    /// <param name="cacheKey">Cache key</param>
    /// <param name="value">Object value</param>
    /// <param name="expiresIn">Expires after given value</param>
    void Set<T>(string cacheKey, T value, TimeSpan? expiresIn = null);
    
    /// <summary>
    /// Sets cache value asynchronous
    /// </summary>
    /// <typeparam name="T">The type of source object</typeparam>
    /// <param name="cacheKey">Cache key</param>
    /// <param name="value">Object value</param>
    /// <param name="expiresIn">Expires after given value</param>
    Task SetAsync<T>(string cacheKey, T value, TimeSpan? expiresIn = null);
    
    /// <summary>
    /// Sets cache value synchronous
    /// </summary>
    /// <typeparam name="T">The type of source object</typeparam>
    /// <param name="cacheKey">Cache key</param>
    /// <param name="value">Object value</param>
    /// <param name="expiresOn">Expires on given date time offset</param>
    void Set<T>(string cacheKey, T value, DateTimeOffset expiresOn);
    
    /// <summary>
    /// Sets cache value asynchronous
    /// </summary>
    /// <typeparam name="T">The type of source object</typeparam>
    /// <param name="cacheKey">Cache key</param>
    /// <param name="value">Object value</param>
    /// <param name="expiresOn">Expires on given date time offset</param>
    Task SetAsync<T>(string cacheKey, T value, DateTimeOffset expiresOn);
    
    /// <summary>
    /// Removes cache key
    /// </summary>
    /// <param name="cacheKey">Cache key</param>
    void Delete(string cacheKey);
    
    /// <summary>
    /// Removes cache key
    /// </summary>
    /// <param name="cacheKey">Cache key</param>
    Task DeleteAsync(string cacheKey);
    
    /// <summary>
    /// Checks given key is exist in cache or not
    /// </summary>
    /// <param name="cacheKey">Cache key</param>
    /// <returns>true/false</returns>
    bool IsExists(string cacheKey);
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eiffel.dev/features/caching/api/icacheservice.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
