diff --git a/CHANGELOG.md b/CHANGELOG.md index b8566aaa..9fddb11a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,7 +104,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) overloads. `NullCache` returns `true`, as its `SetAsync` does — the null store retains nothing, so no key pre-exists and no caller loses; note that it provides no exclusion at all and is what `ICacheFactory.CreateCache` resolves to for an absent or disabled provider, so assert the provider - you expect at startup when the `true` branch runs a side effect that must not repeat. `ICache.Compat.cs` carries the token-positional forwarders + you expect at startup when the `true` branch runs a side effect that must not repeat. `CacheExtensions` carries the token-positional overloads (`TryAddAsync(key, value, token)` and the `TimeSpan?`/`DateTimeOffset?` pairs), matching `SetAsync`. No multi-key overload: Redis has no atomic multi-key `NX`, and all-or-nothing versus per-key semantics would be a guess. This is a cache primitive, not a lock — no ownership token, no early @@ -120,6 +120,44 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Changed +- **BREAKING:** `ICache.Compat.cs`, `IHashCache.Compat.cs` and `ISetCache.Compat.cs` are gone. The + pre-`CachePolicy` convenience overloads they carried as default interface methods — + `GetAsync(key, token)`, `SetAsync(key, value, expiration, token)`, + `TryAddAsync(key, value, token)`, `AddAsync(key, item, token)`, `PopAsync(key, token)` and + the rest — now live as extension methods on the new `CacheExtensions`, `HashCacheExtensions` and + `SetCacheExtensions` static classes in the same `UiPath.Caching` namespace (`SetCacheExtensions` + ships in `UiPath.Caching.Queue`, alongside `ISetCache`). Call sites are unchanged and need no edit; + the interfaces shrink to just the policy-bearing members, so an implementation now has one member to + write per operation instead of one plus an inherited forwarder it could accidentally override. +- **BREAKING:** `ICacheOfT.Sync.cs`, `IHashCacheOfT.Sync.cs` and `ISetCacheOfT.Sync.cs` are gone the + same way. The 59 blocking forwarders they carried as default interface methods — `Get`, `GetOrAdd`, + `Set`, `TryAdd`, `Refresh`, `Remove`, `Contains`, `TimeToLive`, `ExpireTime`, the hash surface's + `GetItem`, `GetCacheEntry`, `GetMetadata` and `SetMetadata`, and the set surface's `Add`, `Pop`, + `Members`, `ContainsItem`, `Count`, `RemoveItem` and `RemoveItems` — now live on the new + `CacheSyncExtensions`, `HashCacheSyncExtensions` and `SetCacheSyncExtensions` static classes + (`SetCacheSyncExtensions` ships in `UiPath.Caching.Queue`). Each still blocks on the async member + via `.AsTask().GetAwaiter().GetResult()`; nothing about the blocking behavior changed. `T` becomes a + method type parameter inferred from the receiver, so call sites are unchanged, and they stay + reachable through the concrete `Cache` / `HashCache` / `SetCache` classes as well as the + interfaces. `partial` comes off `ICache`, `IHashCache` and `ISetCache`, which nothing else + extends now, leaving all three as pure async contracts: an implementation writes only the members it + actually implements, rather than inheriting blocking forwarders it could accidentally override. +- **BREAKING:** `CachePolicy? policy` is now a **required** parameter on every `ICache`, + `IHashCache` and `ISetCache` member that takes one, along with the `expiration` / `setOption` + parameters that precede it — the `= null` defaults are removed. `CacheExtensions` / + `HashCacheExtensions` / `SetCacheExtensions` supply the short forms, so + `cache.GetAsync(key, token)` and `cache.SetAsync(key, value, expiration)` still + compile; what no longer compiles is an interface call that relied on the defaults to skip the policy + slot positionally. This is also what makes the extensions load-bearing rather than decorative: while + the interface still declared `policy = null`, an applicable interface overload existed for every + short call and instance members always beat extension members, so `cache.GetAsync(key, token)` + kept binding to the interface and the extension was never reached. With `policy` required, no + interface overload is applicable to the short forms and there is exactly one way to spell "no + policy". Implementations (`MultilayerCache`, `RedisCache`, their hash + counterparts, `NullCache`, `NullHashCache`, `MultilayerSetCache`, `RedisSetCache`, `NullSetCache`) + drop the defaults too, so behavior is identical whether the call goes through the interface or the + concrete type. The typed `ICache` / `IHashCache` / `ISetCache` façades are unchanged — + they never had a `policy` parameter, since they resolve one at construction. - **BREAKING:** `CacheKey.Equals` and `GetHashCode` are now ordinal rather than `InvariantCultureIgnoreCase`. Insensitive keys are still lowercased at construction, so the stored key and every comparison between insensitive keys are unchanged; what changes is that equality is diff --git a/docs/recipes/batch-get-or-add.md b/docs/recipes/batch-get-or-add.md index 54daccf6..0c8b7627 100644 --- a/docs/recipes/batch-get-or-add.md +++ b/docs/recipes/batch-get-or-add.md @@ -87,9 +87,10 @@ takes `CacheKey[]` directly and does this pairing for you — a caller reaching The generator signature is `Func[]>>` — it receives the states of the entries that missed and returns a pair per state it could resolve. -Parameter order on the call is `entries, generator, [expiration], policy, token`, and every parameter -after the generator is optional — the same shape as the single-key `GetOrAddAsync`. On `ICache` -there is no `policy` parameter at all, since `ICache` resolves one at construction. +Parameter order on the call is `entries, generator, [expiration], policy, token`, and only `token` is +optional — the same shape as the single-key `GetOrAddAsync`. Callers that do not want to pass a +`policy` use the `CacheExtensions` overloads instead. On `ICache` there is no `policy` parameter at +all, since `ICache` resolves one at construction. - **Return a pair for every state you can resolve.** A state you omit comes back as `default(T)` (i.e. `null` for a reference type) and is **not** cached, so the next call retries the source. That is diff --git a/docs/reference/interfaces.md b/docs/reference/interfaces.md index 4aea64d4..5895faa9 100644 --- a/docs/reference/interfaces.md +++ b/docs/reference/interfaces.md @@ -17,7 +17,7 @@ The library's public interface surface. Each entry shows the namespace, signatur **Namespace:** `UiPath.Caching` ```csharp -public partial interface ICache +public interface ICache { string Name { get; } @@ -73,9 +73,9 @@ public partial interface ICache } ``` -`ICache` is the primary typed cache surface for single-value key/value caching. The type parameter `T` fixes the value type for the lifetime of the cache instance, which lets the library resolve `CachePolicy` by `typeof(T).FullName` and apply a single key strategy per cache. Every operation accepts a `CancellationToken` and returns a `ValueTask`, so callers integrate naturally into async pipelines without heap allocation in the hot path. Sync overloads (`Get`, `GetOrAdd`, `Set`, `Remove`, `Refresh`, `Contains`, `TimeToLive`, `ExpireTime`) are provided as blocking default interface methods for call sites that cannot use `await`; `GetOrAdd` covers both the single-key generator shape and a key-only multi-key shape (see below). +`ICache` is the primary typed cache surface for single-value key/value caching. The type parameter `T` fixes the value type for the lifetime of the cache instance, which lets the library resolve `CachePolicy` by `typeof(T).FullName` and apply a single key strategy per cache. Every operation accepts a `CancellationToken` and returns a `ValueTask`, so callers integrate naturally into async pipelines without heap allocation in the hot path. Blocking forwarders (`Get`, `GetOrAdd`, `Set`, `TryAdd`, `Remove`, `Refresh`, `Contains`, `TimeToLive`, `ExpireTime`) live on `CacheSyncExtensions` for call sites that cannot use `await`; each blocks on the async member via `.AsTask().GetAwaiter().GetResult()`, so use them only where the thread-blocking cost is acceptable. `GetOrAdd` covers both the single-key generator shape and a key-only multi-key shape (see below). -The multi-key `GetOrAddAsync` overloads pair each key with an opaque caller state (`TState`) — a database id, a request object, whatever identifies the entry in the caller's own vocabulary. The generator is invoked at most once, with only the states of the entries that missed, and results come back keyed by state. These three overloads are **abstract** on `ICache` — unlike the equivalent members on `ICache`, there is no default body, because `ICache` has no `GetCacheEntriesAsync` and so cannot distinguish a genuine miss from a cached `null` inside a default implementation. A hand-written `ICache` implementation (a test fake, typically) must add all three. There is no key-only convenience overload on the async surface: a caller whose keys are their own identity pairs each key with itself (`TState = CacheKey`). The blocking `GetOrAdd` facade above is the one place that accepts `CacheKey[]` directly and does that pairing for you. +The multi-key `GetOrAddAsync` overloads pair each key with an opaque caller state (`TState`) — a database id, a request object, whatever identifies the entry in the caller's own vocabulary. The generator is invoked at most once, with only the states of the entries that missed, and results come back keyed by state. These three overloads are **abstract** on `ICache` — unlike the equivalent members on `ICache`, there is no default body, because `ICache` has no `GetCacheEntriesAsync` and so cannot distinguish a genuine miss from a cached `null` inside a default implementation. A hand-written `ICache` implementation (a test fake, typically) must add all three. There is no key-only convenience overload on the async surface: a caller whose keys are their own identity pairs each key with itself (`TState = CacheKey`). The blocking `CacheSyncExtensions.GetOrAdd` forwarder is the one place that accepts `CacheKey[]` directly and does that pairing for you. `TryAddAsync` is the conditional-add (create-if-absent) member: it writes only when the key does not already exist, and returns `true` only to the caller that created it. On a Redis-backed cache it maps to StackExchange.Redis `When.NotExists` (`SET key value EX … NX`) — a single atomic round-trip, so exactly one caller across all nodes wins a given key. It is the primitive to reach for when you need at-most-once semantics keyed by something: a dedup marker, an idempotency key, a "who runs this job" election. See [`ICache.TryAddAsync`](#icache) for the full contract, including what a `false` return does and does not tell you. @@ -102,23 +102,23 @@ The multi-key `GetOrAddAsync` overloads pair each key with an opaque cal **Namespace:** `UiPath.Caching` ```csharp -public partial interface ICache : IDisposable +public interface ICache : IDisposable { string Name { get; } - ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default); + ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default); + ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default); - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy, CancellationToken token = default); - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, CachePolicy? policy, CancellationToken token = default) where TState : notnull @@ -136,29 +136,29 @@ public partial interface ICache : IDisposable ValueTask RemoveAsync(CacheKey[] cacheKey, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default); + ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default); - ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken token = default); @@ -170,7 +170,20 @@ public partial interface ICache : IDisposable `ICache` is the dynamic-key, dynamic-type cache surface. Unlike `ICache`, the value type is specified as a generic type argument on each method call rather than fixed at cache-creation time, and a `CachePolicy` can be supplied per call rather than resolved by `typeof(T).FullName`. It also exposes `GetCacheEntryAsync` for callers that need cache-entry metadata (hit/miss status, expiration) in addition to the value. `ICache` implements `IDisposable`, but instances returned by `ICacheFactory.CreateCache(...)` are provider-owned (typically singletons resolved through a `Lazy<>`); their lifetime is managed by the provider and the DI container, so callers should not dispose them per use. -The multi-key `GetOrAddAsync` overloads shown above pair each key with an opaque caller state (`TState`) and are **default interface methods** — each forwards to the shared `BatchGetOrAdd.RunAsync` machinery, so existing `ICache` implementations keep compiling without adding them. The generator is invoked at most once, only with the states of the entries that missed every cache layer, never with keys; results come back keyed by state, one entry per distinct requested state in first-occurrence order. Cache operations de-duplicate by `CacheKey`; results de-duplicate by state — when two states share a key the generator is asked once and the value is reported under both. Their parameter shape matches the single-key `GetOrAddAsync` exactly — `expiration`, `policy` and `token` all optional. `ICache.Compat.cs` carries no token-positional forwarder for them: that file is pre-`CachePolicy` back-compat sugar, and this API predates nothing. There is no key-only convenience overload; a caller whose keys are their own identity pairs each key with itself (`TState = CacheKey`). +Every policy-bearing member takes `policy` as a **required** parameter — there is no `= null` default on the interface. Call sites that do not want a per-call policy use the `CacheExtensions` overloads instead, which omit `policy` (and, where the interface pairs the two, `expiration`) and forward with `policy: null`: + +```csharp +// Interface: policy is explicit. +await cache.GetAsync(key, policy, token); + +// CacheExtensions: the same call without a policy. +await cache.GetAsync(key, token); +await cache.SetAsync(key, order, TimeSpan.FromMinutes(5), token); +``` + +Two reasons the interface is the strict surface. An implementation cannot silently disagree about what "no policy" means, because it never gets to declare a default. And the extensions only work if the interface is strict: instance members always beat extension members in overload resolution, so while the interface declared `policy = null` an applicable interface overload existed for every short call and the extension was never reached. With `policy` required there is exactly one way to spell each call. The extensions are pure forwarders with no behavior of their own, which is why they carry `[ExcludeFromCodeCoverage]` — the policy-bearing implementations are what the tests exercise. + +The multi-key `GetOrAddAsync` overloads shown above pair each key with an opaque caller state (`TState`) and are **default interface methods** — each forwards to the shared `BatchGetOrAdd.RunAsync` machinery, so existing `ICache` implementations keep compiling without adding them. The generator is invoked at most once, only with the states of the entries that missed every cache layer, never with keys; results come back keyed by state, one entry per distinct requested state in first-occurrence order. Cache operations de-duplicate by `CacheKey`; results de-duplicate by state — when two states share a key the generator is asked once and the value is reported under both. Their parameter shape matches the single-key `GetOrAddAsync` exactly — `expiration` and `policy` required, `token` optional. `CacheExtensions` carries no token-positional forwarder for them: those extensions are pre-`CachePolicy` back-compat sugar, and this API predates nothing. There is no key-only convenience overload; a caller whose keys are their own identity pairs each key with itself (`TState = CacheKey`). `TryAddAsync` writes only if the key is absent — StackExchange.Redis `When.NotExists` (`SET … NX`) on Redis-backed caches, in one atomic command with the TTL applied by the same write. Four points decide whether it fits your problem: @@ -231,7 +244,7 @@ The three overloads are **required** members of `ICache` and `ICache`, not de **Namespace:** `UiPath.Caching` ```csharp -public partial interface IHashCache +public interface IHashCache { string Name { get; } @@ -279,7 +292,7 @@ public partial interface IHashCache } ``` -`IHashCache` is the typed hash-cache surface. Each cache key maps to a dictionary of named fields rather than a single value — the backing store is a Redis hash (or an in-memory equivalent). `GetItemAsync` retrieves a single field by name; `GetAsync` retrieves all fields or a subset. `SetAsync` accepts a `HashCacheEntryOptions` overload for per-write control of expiration, metadata, and write scope — `HashCacheSetOption.HashReplace` merges the given fields into the existing hash, `KeyReplace` drops the key first so the written fields are the whole hash. Note that this is write *scope*, not a precondition: the hash surface has no conditional-add member, and `TryAddAsync` exists only on [`ICache`](#icache) / [`ICache`](#icachet). Metadata (`GetMetadataAsync` / `SetMetadataAsync`) provides a side-channel string dictionary attached to the same key, useful for audit or versioning data. Sync overloads (`Get`, `GetItem`, `GetOrAdd`, `Set`, `Refresh`, `Remove`, `Contains`, etc.) are provided as blocking default interface methods. +`IHashCache` is the typed hash-cache surface. Each cache key maps to a dictionary of named fields rather than a single value — the backing store is a Redis hash (or an in-memory equivalent). `GetItemAsync` retrieves a single field by name; `GetAsync` retrieves all fields or a subset. `SetAsync` accepts a `HashCacheEntryOptions` overload for per-write control of expiration, metadata, and write scope — `HashCacheSetOption.HashReplace` merges the given fields into the existing hash, `KeyReplace` drops the key first so the written fields are the whole hash. Note that this is write *scope*, not a precondition: the hash surface has no conditional-add member, and `TryAddAsync` exists only on [`ICache`](#icache) / [`ICache`](#icachet). Metadata (`GetMetadataAsync` / `SetMetadataAsync`) provides a side-channel string dictionary attached to the same key, useful for audit or versioning data. Blocking forwarders (`Get`, `GetItem`, `GetOrAdd`, `Set`, `Refresh`, `Remove`, `Contains`, etc.) live on `HashCacheSyncExtensions`, each blocking on the async member via `.AsTask().GetAwaiter().GetResult()`. > **Typical vs. power-user surface:** `IHashCache` is the standard typed hash surface. If you need to vary the value type per call, use [`IHashCache`](#ihashcache) instead. The two surfaces are different shapes for different problems. @@ -304,41 +317,41 @@ public partial interface IHashCache **Namespace:** `UiPath.Caching` ```csharp -public partial interface IHashCache : IDisposable +public interface IHashCache : IDisposable { string Name { get; } - ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy, CancellationToken token = default); - ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, HashCacheSetOption? setOption = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, HashCacheSetOption? setOption, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default); ValueTask RemoveAsync(CacheKey cacheKey, CancellationToken token = default); @@ -356,6 +369,8 @@ public partial interface IHashCache : IDisposable `IHashCache` is the dynamic-type hash-cache surface. Like [`ICache`](#icache), the value type is specified per method call as a generic type argument, and a `CachePolicy` may be supplied at call time. It extends hash semantics with `GetCacheEntryAsync` for cache-entry metadata inspection. The extra `GetOrAddAsync` overload that accepts `HashCacheSetOption` enables conditional-set semantics (e.g. set-if-not-exists) at the call site. `IHashCache` implements `IDisposable`, but instances returned by `ICacheFactory.CreateHashCache(...)` are provider-owned (typically singletons resolved through a `Lazy<>`); their lifetime is managed by the provider and the DI container, so callers should not dispose them per use. +As on [`ICache`](#icache), `policy` is a **required** parameter on every policy-bearing member; `HashCacheExtensions` supplies the no-policy overloads and forwards with `policy: null`. + > **Typical vs. power-user surface:** `IHashCache` is the power-user hash surface. For most application code with a fixed value type, prefer [`IHashCache`](#ihashcachet) for compile-time safety and automatic policy resolution. The two surfaces are different shapes for different problems. **Use this when:** diff --git a/src/UiPath.Caching.Abstractions/CacheExtensions.cs b/src/UiPath.Caching.Abstractions/CacheExtensions.cs new file mode 100644 index 00000000..e2195b30 --- /dev/null +++ b/src/UiPath.Caching.Abstractions/CacheExtensions.cs @@ -0,0 +1,71 @@ +namespace UiPath.Caching; + +/// +/// Source-compatibility overloads for pre-CachePolicy call sites. Each forwards to the +/// policy-bearing member with policy: null. +/// +// Excluded from coverage — forwarders with no behavior of their own; the policy-bearing impls +// are what tests exercise. +[ExcludeFromCodeCoverage] +public static class CacheExtensions +{ + public static ValueTask GetAsync(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetAsync(cacheKey, null, token); + + public static ValueTask[]> GetAsync(this ICache cache, CacheKey[] cacheKeys, CancellationToken token = default) + => cache.GetAsync(cacheKeys, null, token); + + public static ValueTask> GetCacheEntryAsync(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetCacheEntryAsync(cacheKey, null, token); + + public static ValueTask>[]> GetCacheEntriesAsync(this ICache cache, CacheKey[] cacheKeys, CancellationToken token = default) + => cache.GetCacheEntriesAsync(cacheKeys, null, token); + + public static ValueTask GetOrAddAsync(this ICache cache, CacheKey cacheKey, Func> generator, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, generator, (CachePolicy?)null, token); + + public static ValueTask GetOrAddAsync(this ICache cache, CacheKey cacheKey, Func> generator, TimeSpan? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, generator, expiration, null, token); + + public static ValueTask GetOrAddAsync(this ICache cache, CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, generator, expiration, null, token); + + public static ValueTask SetAsync(this ICache cache, CacheKey cacheKey, T? value, CancellationToken token = default) + => cache.SetAsync(cacheKey, value, (CachePolicy?)null, token); + + public static ValueTask SetAsync(this ICache cache, CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, value, expiration, null, token); + + public static ValueTask SetAsync(this ICache cache, CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, value, expiration, null, token); + + public static ValueTask SetAsync(this ICache cache, KeyValuePair[] keyValues, CancellationToken token = default) + => cache.SetAsync(keyValues, (CachePolicy?)null, token); + + public static ValueTask SetAsync(this ICache cache, KeyValuePair[] keyValues, TimeSpan? expiration, CancellationToken token = default) + => cache.SetAsync(keyValues, expiration, null, token); + + public static ValueTask SetAsync(this ICache cache, KeyValuePair[] keyValues, DateTimeOffset? expiration, CancellationToken token = default) + => cache.SetAsync(keyValues, expiration, null, token); + + /// + public static ValueTask TryAddAsync(this ICache cache, CacheKey cacheKey, T? value, CancellationToken token = default) + => cache.TryAddAsync(cacheKey, value, (CachePolicy?)null, token); + + /// + public static ValueTask TryAddAsync(this ICache cache, CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) + => cache.TryAddAsync(cacheKey, value, expiration, null, token); + + /// + public static ValueTask TryAddAsync(this ICache cache, CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) + => cache.TryAddAsync(cacheKey, value, expiration, null, token); + + public static ValueTask RefreshAsync(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, (CachePolicy?)null, token); + + public static ValueTask RefreshAsync(this ICache cache, CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, null, token); + + public static ValueTask RefreshAsync(this ICache cache, CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, null, token); +} diff --git a/src/UiPath.Caching.Abstractions/CacheSyncExtensions.cs b/src/UiPath.Caching.Abstractions/CacheSyncExtensions.cs new file mode 100644 index 00000000..b4d1ba72 --- /dev/null +++ b/src/UiPath.Caching.Abstractions/CacheSyncExtensions.cs @@ -0,0 +1,104 @@ +namespace UiPath.Caching; + +/// +/// Blocking forwarders over the async API. Each blocks on the underlying +/// call via .AsTask().GetAwaiter().GetResult() — use only from sync call sites that can +/// tolerate the thread-blocking cost. +/// +// Excluded from coverage — forwarders with no behavior of their own; the async impls are what +// tests exercise. +[ExcludeFromCodeCoverage] +public static class CacheSyncExtensions +{ + public static T? Get(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static KeyValuePair[] Get(this ICache cache, CacheKey[] cacheKeys, CancellationToken token = default) + => cache.GetAsync(cacheKeys, token).AsTask().GetAwaiter().GetResult(); + + public static T? GetOrAdd(this ICache cache, CacheKey cacheKey, Func generator, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), token).AsTask().GetAwaiter().GetResult(); + + public static T? GetOrAdd(this ICache cache, CacheKey cacheKey, Func generator, TimeSpan? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); + + public static T? GetOrAdd(this ICache cache, CacheKey cacheKey, Func generator, DateTimeOffset? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); + + public static KeyValuePair[] GetOrAdd(this ICache cache, CacheKey[] cacheKeys, Func[]> generator, CancellationToken token = default) + => cache.GetOrAddAsync( + Array.ConvertAll(cacheKeys, k => new KeyValuePair(k, k)), + (keys, _) => Task.FromResult(generator(keys)), + token) + .AsTask().GetAwaiter().GetResult(); + + public static KeyValuePair[] GetOrAdd(this ICache cache, CacheKey[] cacheKeys, Func[]> generator, TimeSpan? expiration, CancellationToken token = default) + => cache.GetOrAddAsync( + Array.ConvertAll(cacheKeys, k => new KeyValuePair(k, k)), + (keys, _) => Task.FromResult(generator(keys)), + expiration, + token) + .AsTask().GetAwaiter().GetResult(); + + public static KeyValuePair[] GetOrAdd(this ICache cache, CacheKey[] cacheKeys, Func[]> generator, DateTimeOffset? expiration, CancellationToken token = default) + => cache.GetOrAddAsync( + Array.ConvertAll(cacheKeys, k => new KeyValuePair(k, k)), + (keys, _) => Task.FromResult(generator(keys)), + expiration, + token) + .AsTask().GetAwaiter().GetResult(); + + public static bool Remove(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.RemoveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool Remove(this ICache cache, CacheKey[] cacheKeys, CancellationToken token = default) + => cache.RemoveAsync(cacheKeys, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this ICache cache, CacheKey cacheKey, T? value, CancellationToken token = default) + => cache.SetAsync(cacheKey, value, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this ICache cache, CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this ICache cache, CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this ICache cache, KeyValuePair[] keyValues, CancellationToken token = default) + => cache.SetAsync(keyValues, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this ICache cache, KeyValuePair[] keyValues, TimeSpan? expiration = null, CancellationToken token = default) + => cache.SetAsync(keyValues, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this ICache cache, KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CancellationToken token = default) + => cache.SetAsync(keyValues, expiration, token).AsTask().GetAwaiter().GetResult(); + + /// + public static bool TryAdd(this ICache cache, CacheKey cacheKey, T? value, CancellationToken token = default) + => cache.TryAddAsync(cacheKey, value, token).AsTask().GetAwaiter().GetResult(); + + /// + public static bool TryAdd(this ICache cache, CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) + => cache.TryAddAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); + + /// + public static bool TryAdd(this ICache cache, CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) + => cache.TryAddAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Refresh(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool Refresh(this ICache cache, CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Refresh(this ICache cache, CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Contains(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.ContainsAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static TimeSpan? TimeToLive(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.TimeToLiveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static DateTimeOffset? ExpireTime(this ICache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.ExpireTimeAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); +} diff --git a/src/UiPath.Caching.Abstractions/HashCacheExtensions.cs b/src/UiPath.Caching.Abstractions/HashCacheExtensions.cs new file mode 100644 index 00000000..cdd4c070 --- /dev/null +++ b/src/UiPath.Caching.Abstractions/HashCacheExtensions.cs @@ -0,0 +1,59 @@ +namespace UiPath.Caching; + +/// +/// Source-compatibility overloads for pre-CachePolicy call sites. Each forwards to the +/// policy-bearing member with policy: null. +/// +// Excluded from coverage — forwarders with no behavior of their own; the policy-bearing impls +// are what tests exercise. +[ExcludeFromCodeCoverage] +public static class HashCacheExtensions +{ + public static ValueTask GetItemAsync(this IHashCache cache, CacheKey cacheKey, string field, CancellationToken token = default) + => cache.GetItemAsync(cacheKey, field, null, token); + + public static ValueTask> GetAsync(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetAsync(cacheKey, (CachePolicy?)null, token); + + public static ValueTask> GetAsync(this IHashCache cache, CacheKey cacheKey, string[] fields, CancellationToken token = default) + => cache.GetAsync(cacheKey, fields, null, token); + + public static ValueTask>> GetCacheEntryAsync(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetCacheEntryAsync(cacheKey, null, token); + + public static ValueTask> GetOrAddAsync(this IHashCache cache, CacheKey cacheKey, Func>> generator, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, generator, (CachePolicy?)null, token); + + public static ValueTask> GetOrAddAsync(this IHashCache cache, CacheKey cacheKey, Func>> generator, TimeSpan? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, generator, expiration, null, token); + + public static ValueTask> GetOrAddAsync(this IHashCache cache, CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, generator, expiration, (CachePolicy?)null, token); + + public static ValueTask> GetOrAddAsync(this IHashCache cache, CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, HashCacheSetOption? setOption, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, generator, expiration, setOption, null, token); + + public static ValueTask SetAsync(this IHashCache cache, CacheKey cacheKey, IDictionary values, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, (CachePolicy?)null, token); + + public static ValueTask SetAsync(this IHashCache cache, CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, expiration, null, token); + + public static ValueTask SetAsync(this IHashCache cache, CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, expiration, null, token); + + public static ValueTask SetAsync(this IHashCache cache, CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, options, null, token); + + public static ValueTask RefreshAsync(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, (CachePolicy?)null, token); + + public static ValueTask RefreshAsync(this IHashCache cache, CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, null, token); + + public static ValueTask RefreshAsync(this IHashCache cache, CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, null, token); + + public static ValueTask RefreshAsync(this IHashCache cache, CacheKey cacheKey, HashCacheEntryOptions options, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, options, null, token); +} diff --git a/src/UiPath.Caching.Abstractions/HashCacheSyncExtensions.cs b/src/UiPath.Caching.Abstractions/HashCacheSyncExtensions.cs new file mode 100644 index 00000000..5c1f0515 --- /dev/null +++ b/src/UiPath.Caching.Abstractions/HashCacheSyncExtensions.cs @@ -0,0 +1,75 @@ +namespace UiPath.Caching; + +/// +/// Blocking forwarders over the async API. Each blocks on the +/// underlying call via .AsTask().GetAwaiter().GetResult() — use only from sync call sites +/// that can tolerate the thread-blocking cost. +/// +// Excluded from coverage — forwarders with no behavior of their own; the async impls are what +// tests exercise. +[ExcludeFromCodeCoverage] +public static class HashCacheSyncExtensions +{ + public static T? GetItem(this IHashCache cache, CacheKey cacheKey, string field, CancellationToken token = default) + => cache.GetItemAsync(cacheKey, field, token).AsTask().GetAwaiter().GetResult(); + + public static IDictionary Get(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static IDictionary Get(this IHashCache cache, CacheKey cacheKey, string[] fields, CancellationToken token = default) + => cache.GetAsync(cacheKey, fields, token).AsTask().GetAwaiter().GetResult(); + + public static IDictionary GetOrAdd(this IHashCache cache, CacheKey cacheKey, Func> generator, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), token).AsTask().GetAwaiter().GetResult(); + + public static IDictionary GetOrAdd(this IHashCache cache, CacheKey cacheKey, Func> generator, TimeSpan? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); + + public static IDictionary GetOrAdd(this IHashCache cache, CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CancellationToken token = default) + => cache.GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); + + public static ICacheEntry> GetCacheEntry(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetCacheEntryAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this IHashCache cache, CacheKey cacheKey, IDictionary values, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this IHashCache cache, CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this IHashCache cache, CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Set(this IHashCache cache, CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CancellationToken token = default) + => cache.SetAsync(cacheKey, values, options, token).AsTask().GetAwaiter().GetResult(); + + public static bool Refresh(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool Refresh(this IHashCache cache, CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Refresh(this IHashCache cache, CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); + + public static bool Refresh(this IHashCache cache, CacheKey cacheKey, HashCacheEntryOptions options, CancellationToken token = default) + => cache.RefreshAsync(cacheKey, options, token).AsTask().GetAwaiter().GetResult(); + + public static bool Remove(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.RemoveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool Contains(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.ContainsAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static TimeSpan? TimeToLive(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.TimeToLiveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static DateTimeOffset? ExpireTime(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.ExpireTimeAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static IDictionary? GetMetadata(this IHashCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.GetMetadataAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool SetMetadata(this IHashCache cache, CacheKey cacheKey, IDictionary metadata, CancellationToken token = default) + => cache.SetMetadataAsync(cacheKey, metadata, token).AsTask().GetAwaiter().GetResult(); +} diff --git a/src/UiPath.Caching.Abstractions/ICache.Compat.cs b/src/UiPath.Caching.Abstractions/ICache.Compat.cs deleted file mode 100644 index 588b5f38..00000000 --- a/src/UiPath.Caching.Abstractions/ICache.Compat.cs +++ /dev/null @@ -1,83 +0,0 @@ -namespace UiPath.Caching; - -// Source-compatibility default interface methods for pre-CachePolicy call sites. Each forwards -// to the policy-bearing overload with policy=null. Excluded from coverage — these are forwarders -// with no behavior of their own; the policy-bearing impls are what tests exercise. -public partial interface ICache -{ - [ExcludeFromCodeCoverage] - ValueTask GetAsync(CacheKey cacheKey, CancellationToken token = default) - => GetAsync(cacheKey, null, token); - - [ExcludeFromCodeCoverage] - ValueTask[]> GetAsync(CacheKey[] cacheKeys, CancellationToken token = default) - => GetAsync(cacheKeys, null, token); - - [ExcludeFromCodeCoverage] - ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CancellationToken token = default) - => GetCacheEntryAsync(cacheKey, null, token); - - [ExcludeFromCodeCoverage] - ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CancellationToken token = default) - => GetCacheEntriesAsync(cacheKeys, null, token); - - [ExcludeFromCodeCoverage] - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CancellationToken token = default) - => GetOrAddAsync(cacheKey, generator, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, generator, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, generator, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(CacheKey cacheKey, T? value, CancellationToken token = default) - => SetAsync(cacheKey, value, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) - => SetAsync(cacheKey, value, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) - => SetAsync(cacheKey, value, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(KeyValuePair[] keyValues, CancellationToken token = default) - => SetAsync(keyValues, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration, CancellationToken token = default) - => SetAsync(keyValues, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration, CancellationToken token = default) - => SetAsync(keyValues, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask TryAddAsync(CacheKey cacheKey, T? value, CancellationToken token = default) - => TryAddAsync(cacheKey, value, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) - => TryAddAsync(cacheKey, value, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) - => TryAddAsync(cacheKey, value, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask RefreshAsync(CacheKey cacheKey, CancellationToken token = default) - => RefreshAsync(cacheKey, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, null, token); -} diff --git a/src/UiPath.Caching.Abstractions/ICache.cs b/src/UiPath.Caching.Abstractions/ICache.cs index 36f4aaf2..0c710945 100644 --- a/src/UiPath.Caching.Abstractions/ICache.cs +++ b/src/UiPath.Caching.Abstractions/ICache.cs @@ -1,32 +1,32 @@ namespace UiPath.Caching; -public partial interface ICache : IDisposable +public interface ICache : IDisposable { string Name { get; } - ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default); + ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default); + ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default); - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy, CancellationToken token = default); - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, CachePolicy? policy = null, CancellationToken token = default) + ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, CachePolicy? policy, CancellationToken token = default) where TState : notnull => BatchGetOrAdd.RunAsync(this, entries, generator, (pairs, t) => SetAsync(pairs, policy, t), policy, token); - ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) where TState : notnull => BatchGetOrAdd.RunAsync(this, entries, generator, (pairs, t) => SetAsync(pairs, expiration, policy, t), policy, token); - ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) where TState : notnull => BatchGetOrAdd.RunAsync(this, entries, generator, (pairs, t) => SetAsync(pairs, expiration, policy, t), policy, token); @@ -34,17 +34,17 @@ public partial interface ICache : IDisposable ValueTask RemoveAsync(CacheKey[] cacheKey, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); /// /// Writes only if is absent. Redis @@ -54,23 +54,23 @@ public partial interface ICache : IDisposable /// true only if this call created the key. false conflates "it existed" with "the /// write could not be completed", deliberately and fail-closed. Never deletes; not a lock. /// - ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default); + ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default); /// /// /// Lifetime if the entry is created, applied by the same command. Falls back to /// CachePolicy.DistributedExpiration then the cache default. Not in the future: no-op. /// - ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); /// - ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken token = default); diff --git a/src/UiPath.Caching.Abstractions/ICacheOfT.Sync.cs b/src/UiPath.Caching.Abstractions/ICacheOfT.Sync.cs deleted file mode 100644 index 24c1aa18..00000000 --- a/src/UiPath.Caching.Abstractions/ICacheOfT.Sync.cs +++ /dev/null @@ -1,122 +0,0 @@ -namespace UiPath.Caching; - -// Sync forwarders over the async API. Each default interface method blocks on the underlying -// async call via .AsTask().GetAwaiter().GetResult() — use only from sync call sites that can -// tolerate the thread-blocking cost. Excluded from coverage — forwarders with no behavior of -// their own; the async impls are what tests exercise. -public partial interface ICache -{ - [ExcludeFromCodeCoverage] - T? Get(CacheKey cacheKey, CancellationToken token = default) - => GetAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - KeyValuePair[] Get(CacheKey[] cacheKeys, CancellationToken token = default) - => GetAsync(cacheKeys, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - T? GetOrAdd(CacheKey cacheKey, Func generator, CancellationToken token = default) - => GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - T? GetOrAdd(CacheKey cacheKey, Func generator, TimeSpan? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - T? GetOrAdd(CacheKey cacheKey, Func generator, DateTimeOffset? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - KeyValuePair[] GetOrAdd(CacheKey[] cacheKeys, Func[]> generator, CancellationToken token = default) - => GetOrAddAsync( - Array.ConvertAll(cacheKeys, k => new KeyValuePair(k, k)), - (keys, _) => Task.FromResult(generator(keys)), - token) - .AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - KeyValuePair[] GetOrAdd(CacheKey[] cacheKeys, Func[]> generator, TimeSpan? expiration, CancellationToken token = default) - => GetOrAddAsync( - Array.ConvertAll(cacheKeys, k => new KeyValuePair(k, k)), - (keys, _) => Task.FromResult(generator(keys)), - expiration, - token) - .AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - KeyValuePair[] GetOrAdd(CacheKey[] cacheKeys, Func[]> generator, DateTimeOffset? expiration, CancellationToken token = default) - => GetOrAddAsync( - Array.ConvertAll(cacheKeys, k => new KeyValuePair(k, k)), - (keys, _) => Task.FromResult(generator(keys)), - expiration, - token) - .AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Remove(CacheKey cacheKey, CancellationToken token = default) - => RemoveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Remove(CacheKey[] cacheKeys, CancellationToken token = default) - => RemoveAsync(cacheKeys, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(CacheKey cacheKey, T? value, CancellationToken token = default) - => SetAsync(cacheKey, value, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) - => SetAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) - => SetAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(KeyValuePair[] keyValues, CancellationToken token = default) - => SetAsync(keyValues, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(KeyValuePair[] keyValues, TimeSpan? expiration = null, CancellationToken token = default) - => SetAsync(keyValues, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CancellationToken token = default) - => SetAsync(keyValues, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool TryAdd(CacheKey cacheKey, T? value, CancellationToken token = default) - => TryAddAsync(cacheKey, value, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool TryAdd(CacheKey cacheKey, T? value, TimeSpan? expiration, CancellationToken token = default) - => TryAddAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool TryAdd(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CancellationToken token = default) - => TryAddAsync(cacheKey, value, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Refresh(CacheKey cacheKey, CancellationToken token = default) - => RefreshAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Refresh(CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Refresh(CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Contains(CacheKey cacheKey, CancellationToken token = default) - => ContainsAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - TimeSpan? TimeToLive(CacheKey cacheKey, CancellationToken token = default) - => TimeToLiveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - DateTimeOffset? ExpireTime(CacheKey cacheKey, CancellationToken token = default) - => ExpireTimeAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); -} diff --git a/src/UiPath.Caching.Abstractions/ICacheOfT.cs b/src/UiPath.Caching.Abstractions/ICacheOfT.cs index 617d804b..86851e19 100644 --- a/src/UiPath.Caching.Abstractions/ICacheOfT.cs +++ b/src/UiPath.Caching.Abstractions/ICacheOfT.cs @@ -1,5 +1,5 @@ namespace UiPath.Caching; -public partial interface ICache +public interface ICache { string Name { get; } diff --git a/src/UiPath.Caching.Abstractions/IHashCache.Compat.cs b/src/UiPath.Caching.Abstractions/IHashCache.Compat.cs deleted file mode 100644 index 3a8285c1..00000000 --- a/src/UiPath.Caching.Abstractions/IHashCache.Compat.cs +++ /dev/null @@ -1,71 +0,0 @@ -namespace UiPath.Caching; - -// Source-compatibility default interface methods for pre-CachePolicy call sites. Each forwards -// to the policy-bearing overload with policy=null. Excluded from coverage — these are forwarders -// with no behavior of their own; the policy-bearing impls are what tests exercise. -public partial interface IHashCache -{ - [ExcludeFromCodeCoverage] - ValueTask GetItemAsync(CacheKey cacheKey, string field, CancellationToken token = default) - => GetItemAsync(cacheKey, field, null, token); - - [ExcludeFromCodeCoverage] - ValueTask> GetAsync(CacheKey cacheKey, CancellationToken token = default) - => GetAsync(cacheKey, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CancellationToken token = default) - => GetAsync(cacheKey, fields, null, token); - - [ExcludeFromCodeCoverage] - ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CancellationToken token = default) - => GetCacheEntryAsync(cacheKey, null, token); - - [ExcludeFromCodeCoverage] - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CancellationToken token = default) - => GetOrAddAsync(cacheKey, generator, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, generator, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, generator, expiration, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, HashCacheSetOption? setOption, CancellationToken token = default) - => GetOrAddAsync(cacheKey, generator, expiration, setOption, null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CancellationToken token = default) - => SetAsync(cacheKey, values, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CancellationToken token = default) - => SetAsync(cacheKey, values, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CancellationToken token = default) - => SetAsync(cacheKey, values, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CancellationToken token = default) - => SetAsync(cacheKey, values, options, null, token); - - [ExcludeFromCodeCoverage] - ValueTask RefreshAsync(CacheKey cacheKey, CancellationToken token = default) - => RefreshAsync(cacheKey, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CancellationToken token = default) - => RefreshAsync(cacheKey, options, null, token); -} diff --git a/src/UiPath.Caching.Abstractions/IHashCache.cs b/src/UiPath.Caching.Abstractions/IHashCache.cs index 13506faf..38190409 100644 --- a/src/UiPath.Caching.Abstractions/IHashCache.cs +++ b/src/UiPath.Caching.Abstractions/IHashCache.cs @@ -1,40 +1,40 @@ namespace UiPath.Caching; -public partial interface IHashCache : IDisposable +public interface IHashCache : IDisposable { string Name { get; } - ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy = null, CancellationToken token = default); + ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy, CancellationToken token = default); - ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, HashCacheSetOption? setOption = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, HashCacheSetOption? setOption, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default); + ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); - ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default); + ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default); ValueTask RemoveAsync(CacheKey cacheKey, CancellationToken token = default); diff --git a/src/UiPath.Caching.Abstractions/IHashCacheOfT.Sync.cs b/src/UiPath.Caching.Abstractions/IHashCacheOfT.Sync.cs deleted file mode 100644 index 94a23caa..00000000 --- a/src/UiPath.Caching.Abstractions/IHashCacheOfT.Sync.cs +++ /dev/null @@ -1,92 +0,0 @@ -namespace UiPath.Caching; - -// Sync forwarders over the async API. Each default interface method blocks on the underlying -// async call via .AsTask().GetAwaiter().GetResult() — use only from sync call sites that can -// tolerate the thread-blocking cost. Excluded from coverage — forwarders with no behavior of -// their own; the async impls are what tests exercise. -public partial interface IHashCache -{ - [ExcludeFromCodeCoverage] - T? GetItem(CacheKey cacheKey, string field, CancellationToken token = default) - => GetItemAsync(cacheKey, field, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IDictionary Get(CacheKey cacheKey, CancellationToken token = default) - => GetAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IDictionary Get(CacheKey cacheKey, string[] fields, CancellationToken token = default) - => GetAsync(cacheKey, fields, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IDictionary GetOrAdd(CacheKey cacheKey, Func> generator, CancellationToken token = default) - => GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IDictionary GetOrAdd(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IDictionary GetOrAdd(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CancellationToken token = default) - => GetOrAddAsync(cacheKey, _ => Task.FromResult(generator()), expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - ICacheEntry> GetCacheEntry(CacheKey cacheKey, CancellationToken token = default) - => GetCacheEntryAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(CacheKey cacheKey, IDictionary values, CancellationToken token = default) - => SetAsync(cacheKey, values, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CancellationToken token = default) - => SetAsync(cacheKey, values, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CancellationToken token = default) - => SetAsync(cacheKey, values, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Set(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CancellationToken token = default) - => SetAsync(cacheKey, values, options, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Refresh(CacheKey cacheKey, CancellationToken token = default) - => RefreshAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Refresh(CacheKey cacheKey, TimeSpan? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Refresh(CacheKey cacheKey, DateTimeOffset? expiration, CancellationToken token = default) - => RefreshAsync(cacheKey, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Refresh(CacheKey cacheKey, HashCacheEntryOptions options, CancellationToken token = default) - => RefreshAsync(cacheKey, options, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Remove(CacheKey cacheKey, CancellationToken token = default) - => RemoveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Contains(CacheKey cacheKey, CancellationToken token = default) - => ContainsAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - TimeSpan? TimeToLive(CacheKey cacheKey, CancellationToken token = default) - => TimeToLiveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - DateTimeOffset? ExpireTime(CacheKey cacheKey, CancellationToken token = default) - => ExpireTimeAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IDictionary? GetMetadata(CacheKey cacheKey, CancellationToken token = default) - => GetMetadataAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool SetMetadata(CacheKey cacheKey, IDictionary metadata, CancellationToken token = default) - => SetMetadataAsync(cacheKey, metadata, token).AsTask().GetAwaiter().GetResult(); -} diff --git a/src/UiPath.Caching.Abstractions/IHashCacheOfT.cs b/src/UiPath.Caching.Abstractions/IHashCacheOfT.cs index 566922e8..9560f79a 100644 --- a/src/UiPath.Caching.Abstractions/IHashCacheOfT.cs +++ b/src/UiPath.Caching.Abstractions/IHashCacheOfT.cs @@ -1,6 +1,6 @@ namespace UiPath.Caching; -public partial interface IHashCache +public interface IHashCache { string Name { get; } diff --git a/src/UiPath.Caching.Abstractions/NullCache.cs b/src/UiPath.Caching.Abstractions/NullCache.cs index d4d71b71..c2ffbdf1 100644 --- a/src/UiPath.Caching.Abstractions/NullCache.cs +++ b/src/UiPath.Caching.Abstractions/NullCache.cs @@ -19,25 +19,25 @@ public ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken tok return ValueTask.FromResult(default(DateTimeOffset?)); } - public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult(default(T?)); } - public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult(cacheKeys.Select(k => new KeyValuePair(k, default(T?))).ToArray()); } - public ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult(NullCacheEntry.Instance); } - public ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult(cacheKeys @@ -45,36 +45,36 @@ public ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken tok .ToArray()); } - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy, CancellationToken token = default) => ReturnGeneratorAsync(generator, token); - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnGeneratorAsync(generator, token); - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnGeneratorAsync(generator, token); - public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); public ValueTask RemoveAsync(CacheKey cacheKey, CancellationToken token = default) => ReturnTrueAsync(); public ValueTask RemoveAsync(CacheKey[] cacheKey, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); /// /// Always true, as SetAsync is here: nothing is retained, so no key pre-exists and @@ -82,13 +82,13 @@ public ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken tok /// ICacheFactory.CreateCache resolves to for an absent or disabled provider, so assert the /// provider you expect at startup. /// - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); /// - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); /// - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); public ValueTask TimeToLiveAsync(CacheKey cacheKey, CancellationToken token = default) { diff --git a/src/UiPath.Caching.Abstractions/NullHashCache.cs b/src/UiPath.Caching.Abstractions/NullHashCache.cs index cc830539..e15a9e02 100644 --- a/src/UiPath.Caching.Abstractions/NullHashCache.cs +++ b/src/UiPath.Caching.Abstractions/NullHashCache.cs @@ -21,19 +21,19 @@ public ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken tok return ValueTask.FromResult(default(DateTimeOffset?)); } - public ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult((IDictionary)ImmutableDictionary.Empty); } - public ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult((IDictionary)ImmutableDictionary.Empty); } - public ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult(NullCacheEntry>.Instance); @@ -45,41 +45,41 @@ public ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken tok return ValueTask.FromResult?>(default); } - public ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult(default(T?)); } - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy, CancellationToken token = default) => ReturnGeneratorAsync(generator, token); - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnGeneratorAsync(generator, token); - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnGeneratorAsync(generator, token); - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, HashCacheSetOption? setOption = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, HashCacheSetOption? setOption, CachePolicy? policy, CancellationToken token = default) => ReturnGeneratorAsync(generator, token); - public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); public ValueTask RemoveAsync(CacheKey cacheKey, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default) => ReturnTrueAsync(); + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default) => ReturnTrueAsync(); public ValueTask SetMetadataAsync(CacheKey cacheKey, IDictionary metadata, CancellationToken token = default) => ReturnTrueAsync(); diff --git a/src/UiPath.Caching.Abstractions/PublicAPI.Shipped.txt b/src/UiPath.Caching.Abstractions/PublicAPI.Shipped.txt index 9703a2f4..5d46a078 100644 --- a/src/UiPath.Caching.Abstractions/PublicAPI.Shipped.txt +++ b/src/UiPath.Caching.Abstractions/PublicAPI.Shipped.txt @@ -234,60 +234,15 @@ UiPath.Caching.HashCacheSetOption.KeyReplace = 1 -> UiPath.Caching.HashCacheSetO UiPath.Caching.ICache UiPath.Caching.ICache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.ExpireTimeAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> -UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> -UiPath.Caching.ICache.GetCacheEntriesAsync(UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>[]!> -UiPath.Caching.ICache.GetCacheEntriesAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>[]!> -UiPath.Caching.ICache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.ICache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> -UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> -UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> -UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.Name.get -> string! -UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.RemoveAsync(UiPath.Caching.CacheKey[]! cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.TimeToLiveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache -UiPath.Caching.ICache.Contains(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ICache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.ExpireTime(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.DateTimeOffset? UiPath.Caching.ICache.ExpireTimeAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.Get(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? -UiPath.Caching.ICache.Get(UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> -UiPath.Caching.ICache.GetOrAdd(UiPath.Caching.CacheKey cacheKey, System.Func! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? -UiPath.Caching.ICache.GetOrAdd(UiPath.Caching.CacheKey cacheKey, System.Func! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? -UiPath.Caching.ICache.GetOrAdd(UiPath.Caching.CacheKey cacheKey, System.Func! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? -UiPath.Caching.ICache.GetOrAdd(UiPath.Caching.CacheKey[]! cacheKeys, System.Func[]!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! -UiPath.Caching.ICache.GetOrAdd(UiPath.Caching.CacheKey[]! cacheKeys, System.Func[]!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! -UiPath.Caching.ICache.GetOrAdd(UiPath.Caching.CacheKey[]! cacheKeys, System.Func[]!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask @@ -295,29 +250,17 @@ UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyVal UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> UiPath.Caching.ICache.Name.get -> string! -UiPath.Caching.ICache.Refresh(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Refresh(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Refresh(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.Remove(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Remove(UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ICache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.RemoveAsync(UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.Set(System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Set(System.Collections.Generic.KeyValuePair[]! keyValues, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Set(System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Set(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Set(UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.Set(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.TimeToLive(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.TimeSpan? UiPath.Caching.ICache.TimeToLiveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICacheChangeToken UiPath.Caching.ICacheChangeToken.Expiration.get -> System.DateTimeOffset? @@ -359,86 +302,33 @@ UiPath.Caching.IConnectionState.OnReconnected -> System.EventHandler? UiPath.Caching.IHashCache UiPath.Caching.IHashCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.ExpireTimeAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, string![]! fields, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, string![]! fields, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>!> -UiPath.Caching.IHashCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>!> -UiPath.Caching.IHashCache.GetItemAsync(UiPath.Caching.CacheKey cacheKey, string! field, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.GetItemAsync(UiPath.Caching.CacheKey cacheKey, string! field, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.GetMetadataAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask?> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration = null, UiPath.Caching.HashCacheSetOption? setOption = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.HashCacheSetOption? setOption, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.IHashCache.Name.get -> string! -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.SetMetadataAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! metadata, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.TimeToLiveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache -UiPath.Caching.IHashCache.Contains(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.IHashCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.ExpireTime(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.DateTimeOffset? UiPath.Caching.IHashCache.ExpireTimeAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.Get(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! -UiPath.Caching.IHashCache.Get(UiPath.Caching.CacheKey cacheKey, string![]! fields, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, string![]! fields, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.IHashCache.GetCacheEntry(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> UiPath.Caching.ICacheEntry!>! UiPath.Caching.IHashCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>!> -UiPath.Caching.IHashCache.GetItem(UiPath.Caching.CacheKey cacheKey, string! field, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? UiPath.Caching.IHashCache.GetItemAsync(UiPath.Caching.CacheKey cacheKey, string! field, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.GetMetadata(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary? UiPath.Caching.IHashCache.GetMetadataAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask?> -UiPath.Caching.IHashCache.GetOrAdd(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! -UiPath.Caching.IHashCache.GetOrAdd(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! -UiPath.Caching.IHashCache.GetOrAdd(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.IHashCache.Name.get -> string! -UiPath.Caching.IHashCache.Refresh(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.IHashCache.Refresh(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.IHashCache.Refresh(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.IHashCache.Refresh(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.Remove(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.IHashCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.Set(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.IHashCache.Set(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.IHashCache.Set(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.IHashCache.Set(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.SetMetadata(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! metadata, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.IHashCache.SetMetadataAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! metadata, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.IHashCache.TimeToLive(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.TimeSpan? UiPath.Caching.IHashCache.TimeToLiveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISerializerProxy UiPath.Caching.ISerializerProxy.Deserialize(T1? value) -> T? @@ -474,26 +364,10 @@ UiPath.Caching.NullCache UiPath.Caching.NullCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullCache.Dispose() -> void UiPath.Caching.NullCache.ExpireTimeAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.GetAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> -UiPath.Caching.NullCache.GetCacheEntriesAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>[]!> -UiPath.Caching.NullCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.NullCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullCache.Name.get -> string! UiPath.Caching.NullCache.NullCache() -> void -UiPath.Caching.NullCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullCache.RemoveAsync(UiPath.Caching.CacheKey[]! cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullCache.TimeToLiveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullCacheFactory UiPath.Caching.NullCacheFactory.AddProvider(UiPath.Caching.ICacheProvider! provider) -> void @@ -506,26 +380,10 @@ UiPath.Caching.NullHashCache UiPath.Caching.NullHashCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullHashCache.Dispose() -> void UiPath.Caching.NullHashCache.ExpireTimeAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.NullHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, string![]! fields, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.NullHashCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>!> -UiPath.Caching.NullHashCache.GetItemAsync(UiPath.Caching.CacheKey cacheKey, string! field, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullHashCache.GetMetadataAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask?> -UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration = null, UiPath.Caching.HashCacheSetOption? setOption = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.NullHashCache.Name.get -> string! UiPath.Caching.NullHashCache.NullHashCache() -> void -UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullHashCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullHashCache.SetMetadataAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! metadata, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullHashCache.TimeToLiveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.Policies.EmptyResiliencePipeline diff --git a/src/UiPath.Caching.Abstractions/PublicAPI.Unshipped.txt b/src/UiPath.Caching.Abstractions/PublicAPI.Unshipped.txt index 32cc4170..de9aae81 100644 --- a/src/UiPath.Caching.Abstractions/PublicAPI.Unshipped.txt +++ b/src/UiPath.Caching.Abstractions/PublicAPI.Unshipped.txt @@ -1,7 +1,10 @@ #nullable enable +*REMOVED*UiPath.Caching.Broadcast.IEventFormatterProxy.Decode(string! body) -> T? +*REMOVED*UiPath.Caching.Broadcast.IEventFormatterProxy.EncodeAsString(T event) -> string? UiPath.Caching.Cache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.Cache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.Cache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.CacheExtensions UiPath.Caching.CacheKey.CacheKey(string? name, UiPath.Caching.CacheKeyCasing casing) -> void UiPath.Caching.CacheKey.Casing.get -> UiPath.Caching.CacheKeyCasing UiPath.Caching.CacheKey.WithName(string? name) -> UiPath.Caching.CacheKey @@ -12,34 +15,177 @@ UiPath.Caching.CacheKeyComparer UiPath.Caching.CacheKeyComparer.CacheKeyComparer() -> void UiPath.Caching.CacheOptions.KeyCasing.get -> UiPath.Caching.CacheKeyCasing UiPath.Caching.CacheOptions.KeyCasing.set -> void -UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ICache.TryAdd(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.TryAdd(UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool -UiPath.Caching.ICache.TryAdd(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +UiPath.Caching.CacheSyncExtensions +UiPath.Caching.HashCacheExtensions +UiPath.Caching.HashCacheSyncExtensions +UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.GetAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> +UiPath.Caching.ICache.GetCacheEntriesAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>[]!> +UiPath.Caching.ICache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> +UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> +UiPath.Caching.ICache.GetOrAddAsync(System.Collections.Generic.KeyValuePair[]! entries, System.Func[]!>!>! generator, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> +UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ICache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullCache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.IHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, string![]! fields, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.IHashCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>!> +UiPath.Caching.IHashCache.GetItemAsync(UiPath.Caching.CacheKey cacheKey, string! field, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.HashCacheSetOption? setOption, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.IHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.IHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.GetAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> +UiPath.Caching.NullCache.GetCacheEntriesAsync(UiPath.Caching.CacheKey[]! cacheKeys, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>[]!> +UiPath.Caching.NullCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.SetAsync(System.Collections.Generic.KeyValuePair[]! keyValues, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.SetAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullCache.TryAddAsync(UiPath.Caching.CacheKey cacheKey, T? value, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullHashCache.GetAsync(UiPath.Caching.CacheKey cacheKey, string![]! fields, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullHashCache.GetCacheEntryAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>!> +UiPath.Caching.NullHashCache.GetItemAsync(UiPath.Caching.CacheKey cacheKey, string! field, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.HashCacheSetOption? setOption, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullHashCache.GetOrAddAsync(UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.RefreshAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullHashCache.SetAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.RawByteSerializerProxy +UiPath.Caching.RawByteSerializerProxy.RawByteSerializerProxy(System.Text.Json.JsonSerializerOptions? options = null) -> void UiPath.Caching.SystemJsonByteSerializerProxy UiPath.Caching.SystemJsonByteSerializerProxy.SystemJsonByteSerializerProxy(System.Text.Json.JsonSerializerOptions? options = null) -> void -virtual UiPath.Caching.SystemJsonByteSerializerProxy.Serialize(object? value) -> byte[]? -virtual UiPath.Caching.SystemJsonByteSerializerProxy.Deserialize(byte[]? value) -> T? -UiPath.Caching.SystemJsonByteSerializerProxy.TryDeserialize(string? value, out T? result) -> bool UiPath.Caching.SystemJsonByteSerializerProxy.TryDeserialize(object? value, out T? result) -> bool -UiPath.Caching.RawByteSerializerProxy -UiPath.Caching.RawByteSerializerProxy.RawByteSerializerProxy(System.Text.Json.JsonSerializerOptions? options = null) -> void -override UiPath.Caching.RawByteSerializerProxy.Serialize(object? value) -> byte[]? +UiPath.Caching.SystemJsonByteSerializerProxy.TryDeserialize(string? value, out T? result) -> bool override UiPath.Caching.RawByteSerializerProxy.Deserialize(byte[]? value) -> T -*REMOVED*UiPath.Caching.Broadcast.IEventFormatterProxy.Decode(string! body) -> T? -*REMOVED*UiPath.Caching.Broadcast.IEventFormatterProxy.EncodeAsString(T event) -> string? +override UiPath.Caching.RawByteSerializerProxy.Serialize(object? value) -> byte[]? +static UiPath.Caching.CacheExtensions.GetAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.GetAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask[]!> +static UiPath.Caching.CacheExtensions.GetCacheEntriesAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>[]!> +static UiPath.Caching.CacheExtensions.GetCacheEntryAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.CacheExtensions.GetOrAddAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.GetOrAddAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.GetOrAddAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.RefreshAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.RefreshAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.RefreshAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.SetAsync(this UiPath.Caching.ICache! cache, System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.SetAsync(this UiPath.Caching.ICache! cache, System.Collections.Generic.KeyValuePair[]! keyValues, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.SetAsync(this UiPath.Caching.ICache! cache, System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.SetAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.SetAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.SetAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.TryAddAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.TryAddAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.CacheExtensions.TryAddAsync(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask static UiPath.Caching.CacheKey.DefaultCasing.get -> UiPath.Caching.CacheKeyCasing static UiPath.Caching.CacheKey.DefaultCasing.set -> void static UiPath.Caching.CacheKeyComparer.Insensitive.get -> UiPath.Caching.CacheKeyComparer! static UiPath.Caching.CacheKeyComparer.Sensitive.get -> UiPath.Caching.CacheKeyComparer! +static UiPath.Caching.CacheSyncExtensions.Contains(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.ExpireTime(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.DateTimeOffset? +static UiPath.Caching.CacheSyncExtensions.Get(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? +static UiPath.Caching.CacheSyncExtensions.Get(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! +static UiPath.Caching.CacheSyncExtensions.GetOrAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Func! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? +static UiPath.Caching.CacheSyncExtensions.GetOrAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Func! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? +static UiPath.Caching.CacheSyncExtensions.GetOrAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Func! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? +static UiPath.Caching.CacheSyncExtensions.GetOrAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey[]! cacheKeys, System.Func[]!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! +static UiPath.Caching.CacheSyncExtensions.GetOrAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey[]! cacheKeys, System.Func[]!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! +static UiPath.Caching.CacheSyncExtensions.GetOrAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey[]! cacheKeys, System.Func[]!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.KeyValuePair[]! +static UiPath.Caching.CacheSyncExtensions.Refresh(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Refresh(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Refresh(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Remove(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Remove(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey[]! cacheKeys, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Set(this UiPath.Caching.ICache! cache, System.Collections.Generic.KeyValuePair[]! keyValues, System.DateTimeOffset? expiration = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Set(this UiPath.Caching.ICache! cache, System.Collections.Generic.KeyValuePair[]! keyValues, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Set(this UiPath.Caching.ICache! cache, System.Collections.Generic.KeyValuePair[]! keyValues, System.TimeSpan? expiration = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Set(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Set(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.Set(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.TimeToLive(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.TimeSpan? +static UiPath.Caching.CacheSyncExtensions.TryAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.TryAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.CacheSyncExtensions.TryAdd(this UiPath.Caching.ICache! cache, UiPath.Caching.CacheKey cacheKey, T? value, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheExtensions.GetAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.HashCacheExtensions.GetAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, string![]! fields, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.HashCacheExtensions.GetCacheEntryAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!>!> +static UiPath.Caching.HashCacheExtensions.GetItemAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, string! field, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.GetOrAddAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.HashCacheExtensions.GetOrAddAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.DateTimeOffset? expiration, UiPath.Caching.HashCacheSetOption? setOption, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.HashCacheExtensions.GetOrAddAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.HashCacheExtensions.GetOrAddAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.HashCacheExtensions.RefreshAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.RefreshAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.RefreshAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.RefreshAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.SetAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.SetAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.SetAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheExtensions.SetAsync(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.HashCacheSyncExtensions.Contains(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.ExpireTime(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.DateTimeOffset? +static UiPath.Caching.HashCacheSyncExtensions.Get(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! +static UiPath.Caching.HashCacheSyncExtensions.Get(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, string![]! fields, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! +static UiPath.Caching.HashCacheSyncExtensions.GetCacheEntry(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> UiPath.Caching.ICacheEntry!>! +static UiPath.Caching.HashCacheSyncExtensions.GetItem(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, string! field, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? +static UiPath.Caching.HashCacheSyncExtensions.GetMetadata(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary? +static UiPath.Caching.HashCacheSyncExtensions.GetOrAdd(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! +static UiPath.Caching.HashCacheSyncExtensions.GetOrAdd(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! +static UiPath.Caching.HashCacheSyncExtensions.GetOrAdd(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Func!>! generator, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IDictionary! +static UiPath.Caching.HashCacheSyncExtensions.Refresh(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Refresh(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Refresh(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Refresh(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Remove(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Set(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Set(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Set(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.Set(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! values, UiPath.Caching.HashCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.SetMetadata(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IDictionary! metadata, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.HashCacheSyncExtensions.TimeToLive(this UiPath.Caching.IHashCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.TimeSpan? +virtual UiPath.Caching.SystemJsonByteSerializerProxy.Deserialize(byte[]? value) -> T? +virtual UiPath.Caching.SystemJsonByteSerializerProxy.Serialize(object? value) -> byte[]? diff --git a/src/UiPath.Caching.Queue/ISetCache.Compat.cs b/src/UiPath.Caching.Queue/ISetCache.Compat.cs deleted file mode 100644 index 2f776c74..00000000 --- a/src/UiPath.Caching.Queue/ISetCache.Compat.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace UiPath.Caching; - -// Source-compatibility default interface methods for pre-CachePolicy call sites. Each forwards -// to the policy-bearing overload with policy=null. Excluded from coverage — these are forwarders -// with no behavior of their own; the policy-bearing impls are what tests exercise. -public partial interface ISetCache -{ - [ExcludeFromCodeCoverage] - ValueTask AddAsync(CacheKey cacheKey, T item, CancellationToken token = default) - => AddAsync(cacheKey, item, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CancellationToken token = default) - => AddAsync(cacheKey, items, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CancellationToken token = default) - => AddAsync(cacheKey, items, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CancellationToken token = default) - => AddAsync(cacheKey, items, expiration, null, token); - - [ExcludeFromCodeCoverage] - ValueTask PopAsync(CacheKey cacheKey, CancellationToken token = default) - => PopAsync(cacheKey, (CachePolicy?)null, token); - - [ExcludeFromCodeCoverage] - ValueTask> PopAsync(CacheKey cacheKey, long count, CancellationToken token = default) - => PopAsync(cacheKey, count, null, token); - - [ExcludeFromCodeCoverage] - ValueTask> MembersAsync(CacheKey cacheKey, CancellationToken token = default) - => MembersAsync(cacheKey, (CachePolicy?)null, token); -} diff --git a/src/UiPath.Caching.Queue/ISetCache.cs b/src/UiPath.Caching.Queue/ISetCache.cs index 5b6a36e4..af7c45f7 100644 --- a/src/UiPath.Caching.Queue/ISetCache.cs +++ b/src/UiPath.Caching.Queue/ISetCache.cs @@ -6,7 +6,7 @@ namespace UiPath.Caching; /// insertion order and PopAsync removes a random member (Redis SPOP). Use the dedicated list /// caches when order matters. /// -public partial interface ISetCache : IDisposable +public interface ISetCache : IDisposable { string Name { get; } @@ -15,30 +15,30 @@ public partial interface ISetCache : IDisposable /// TTL). Every AddAsync call re-applies the resolved expiration, so adding any member resets the /// TTL of the entire set. /// - ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy = null, CancellationToken token = default); + ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy, CancellationToken token = default); /// - ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy = null, CancellationToken token = default); + ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy, CancellationToken token = default); /// - ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default); /// - ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default); + ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default); /// /// Removes and returns a random member of the set (Redis SPOP). The set is unordered, so this is /// not a FIFO/LIFO dequeue — callers must not assume any insertion order. /// - ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); /// /// Removes and returns up to count random members of the set (Redis SPOP). The set is unordered, /// so this is not a FIFO/LIFO dequeue — callers must not assume any insertion order. /// - ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy, CancellationToken token = default); - ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default); + ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default); ValueTask ContainsItemAsync(CacheKey cacheKey, T item, CancellationToken token = default); diff --git a/src/UiPath.Caching.Queue/ISetCacheOfT.Sync.cs b/src/UiPath.Caching.Queue/ISetCacheOfT.Sync.cs deleted file mode 100644 index 716dbf86..00000000 --- a/src/UiPath.Caching.Queue/ISetCacheOfT.Sync.cs +++ /dev/null @@ -1,60 +0,0 @@ -namespace UiPath.Caching; - -// Sync forwarders over the async API. Each default interface method blocks on the underlying -// async call via .AsTask().GetAwaiter().GetResult() — use only from sync call sites that can -// tolerate the thread-blocking cost. Excluded from coverage — forwarders with no behavior of -// their own; the async impls are what tests exercise. -public partial interface ISetCache -{ - [ExcludeFromCodeCoverage] - bool Add(CacheKey cacheKey, T item, CancellationToken token = default) - => AddAsync(cacheKey, item, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - long Add(CacheKey cacheKey, IEnumerable items, CancellationToken token = default) - => AddAsync(cacheKey, items, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - long Add(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CancellationToken token = default) - => AddAsync(cacheKey, items, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - long Add(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CancellationToken token = default) - => AddAsync(cacheKey, items, expiration, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - T? Pop(CacheKey cacheKey, CancellationToken token = default) - => PopAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IReadOnlyCollection Pop(CacheKey cacheKey, long count, CancellationToken token = default) - => PopAsync(cacheKey, count, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - IReadOnlyCollection Members(CacheKey cacheKey, CancellationToken token = default) - => MembersAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool ContainsItem(CacheKey cacheKey, T item, CancellationToken token = default) - => ContainsItemAsync(cacheKey, item, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - long Count(CacheKey cacheKey, CancellationToken token = default) - => CountAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool RemoveItem(CacheKey cacheKey, T item, CancellationToken token = default) - => RemoveItemAsync(cacheKey, item, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - long RemoveItems(CacheKey cacheKey, IEnumerable items, CancellationToken token = default) - => RemoveItemsAsync(cacheKey, items, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Remove(CacheKey cacheKey, CancellationToken token = default) - => RemoveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); - - [ExcludeFromCodeCoverage] - bool Contains(CacheKey cacheKey, CancellationToken token = default) - => ContainsAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); -} diff --git a/src/UiPath.Caching.Queue/ISetCacheOfT.cs b/src/UiPath.Caching.Queue/ISetCacheOfT.cs index 3a7050af..875783b3 100644 --- a/src/UiPath.Caching.Queue/ISetCacheOfT.cs +++ b/src/UiPath.Caching.Queue/ISetCacheOfT.cs @@ -6,7 +6,7 @@ namespace UiPath.Caching; /// insertion order and PopAsync removes a random member (Redis SPOP). Use the dedicated list caches /// when order matters. /// -public partial interface ISetCache +public interface ISetCache { string Name { get; } diff --git a/src/UiPath.Caching.Queue/MultilayerSetCache.cs b/src/UiPath.Caching.Queue/MultilayerSetCache.cs index 3bd00850..b619b635 100644 --- a/src/UiPath.Caching.Queue/MultilayerSetCache.cs +++ b/src/UiPath.Caching.Queue/MultilayerSetCache.cs @@ -51,25 +51,25 @@ inner is IConnectionState state public string Name => _name; - public async ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return await InternalAddAsync(cacheKey, item, policy, token).ConfigureAwait(false); } - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy, CancellationToken token = default) => AddAsync(cacheKey, items, expiration: (DateTimeOffset?)null, policy, token); - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => AddAsync(cacheKey, items, FromTtl(expiration), policy, token); - public async ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return await InternalAddAsync(cacheKey, Materialize(items), expiration, policy, token).ConfigureAwait(false); } - public async ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var key = Key(cacheKey, token); @@ -86,7 +86,7 @@ public async ValueTask AddAsync(CacheKey cacheKey, IEnumerable items return value; } - public async ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var key = Key(cacheKey, token); @@ -102,7 +102,7 @@ public async ValueTask AddAsync(CacheKey cacheKey, IEnumerable items return values; } - public async ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var key = Key(cacheKey, token); diff --git a/src/UiPath.Caching.Queue/NullSetCache.cs b/src/UiPath.Caching.Queue/NullSetCache.cs index dd9f78f7..c0a8728e 100644 --- a/src/UiPath.Caching.Queue/NullSetCache.cs +++ b/src/UiPath.Caching.Queue/NullSetCache.cs @@ -7,23 +7,23 @@ public sealed class NullSetCache : ISetCache public string Name => "Null"; - public ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy = null, CancellationToken token = default) => ReturnFalseAsync(); + public ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy, CancellationToken token = default) => ReturnFalseAsync(); - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy = null, CancellationToken token = default) => ReturnZeroAsync(); + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy, CancellationToken token = default) => ReturnZeroAsync(); - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnZeroAsync(); + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnZeroAsync(); - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ReturnZeroAsync(); + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ReturnZeroAsync(); - public ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return ValueTask.FromResult(default(T?)); } - public ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy = null, CancellationToken token = default) => EmptyAsync(); + public ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy, CancellationToken token = default) => EmptyAsync(); - public ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => EmptyAsync(); + public ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => EmptyAsync(); public ValueTask ContainsItemAsync(CacheKey cacheKey, T item, CancellationToken token = default) => ReturnFalseAsync(); diff --git a/src/UiPath.Caching.Queue/PublicAPI.Shipped.txt b/src/UiPath.Caching.Queue/PublicAPI.Shipped.txt index db55e994..309ca311 100644 --- a/src/UiPath.Caching.Queue/PublicAPI.Shipped.txt +++ b/src/UiPath.Caching.Queue/PublicAPI.Shipped.txt @@ -8,54 +8,27 @@ UiPath.Caching.IQueueCacheProvider.CreateSetCache() -> UiPath.Caching.ISetCache! UiPath.Caching.IQueueCacheProvider.Enabled.get -> bool UiPath.Caching.IQueueCacheProvider.Name.get -> string! UiPath.Caching.ISetCache -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.ContainsItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.CountAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.ISetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.ISetCache.Name.get -> string! -UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.ISetCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.RemoveItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.RemoveItemsAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache -UiPath.Caching.ISetCache.Add(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long -UiPath.Caching.ISetCache.Add(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long -UiPath.Caching.ISetCache.Add(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long -UiPath.Caching.ISetCache.Add(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.Contains(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ISetCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.ContainsItem(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ISetCache.ContainsItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.Count(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long UiPath.Caching.ISetCache.CountAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.Members(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IReadOnlyCollection! UiPath.Caching.ISetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.ISetCache.Name.get -> string! -UiPath.Caching.ISetCache.Pop(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? -UiPath.Caching.ISetCache.Pop(UiPath.Caching.CacheKey cacheKey, long count, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IReadOnlyCollection! UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> -UiPath.Caching.ISetCache.Remove(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ISetCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.RemoveItem(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool UiPath.Caching.ISetCache.RemoveItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.ISetCache.RemoveItems(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long UiPath.Caching.ISetCache.RemoveItemsAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.InMemoryQueueCacheOptions UiPath.Caching.InMemoryQueueCacheOptions.CompactionPercentage.get -> double? @@ -116,19 +89,12 @@ UiPath.Caching.NullQueueCacheFactory.Dispose() -> void UiPath.Caching.NullQueueCacheFactory.NullQueueCacheFactory() -> void UiPath.Caching.NullQueueCacheFactory.ProviderNames.get -> System.Collections.Generic.IEnumerable! UiPath.Caching.NullSetCache -UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullSetCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullSetCache.ContainsItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullSetCache.CountAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullSetCache.Dispose() -> void -UiPath.Caching.NullSetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.NullSetCache.Name.get -> string! UiPath.Caching.NullSetCache.NullSetCache() -> void -UiPath.Caching.NullSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.NullSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.NullSetCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullSetCache.RemoveItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.NullSetCache.RemoveItemsAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask @@ -142,17 +108,10 @@ UiPath.Caching.QueueCacheFactory.QueueCacheFactory(Microsoft.Extensions.Options. UiPath.Caching.QueueCacheFactory.QueueCacheFactory(Microsoft.Extensions.Options.IOptions! cacheOptions, System.Collections.Generic.IEnumerable! providers) -> void UiPath.Caching.QueueCacheFactoryExtensions UiPath.Caching.Redis.RedisSetCache -UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration = null, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.Redis.RedisSetCache.ContainsAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.Redis.RedisSetCache.ContainsItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.Redis.RedisSetCache.CountAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.Redis.RedisSetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.Redis.RedisSetCache.Name.get -> string! -UiPath.Caching.Redis.RedisSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask -UiPath.Caching.Redis.RedisSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, UiPath.Caching.CachePolicy? policy = null, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> UiPath.Caching.Redis.RedisSetCache.RedisSetCache(UiPath.Caching.Redis.IRedisConnector! redis, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Policies.IResiliencePipelineProvider! resiliencePipelineProvider, UiPath.Caching.Telemetry.ICachingTelemetryProvider! telemetryProvider, UiPath.Caching.Redis.RedisCacheOptions! redisCacheOptions, UiPath.Caching.CacheOptions! cacheOptions, UiPath.Caching.Redis.RedisSetCacheOptions! setCacheOptions, UiPath.Caching.ICachePolicyFactory! policyFactory, Microsoft.Extensions.Logging.ILogger! logger) -> void UiPath.Caching.Redis.RedisSetCache.RemoveAsync(UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask UiPath.Caching.Redis.RedisSetCache.RemoveItemAsync(UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask diff --git a/src/UiPath.Caching.Queue/PublicAPI.Unshipped.txt b/src/UiPath.Caching.Queue/PublicAPI.Unshipped.txt index 874e42e9..a4ae56f1 100644 --- a/src/UiPath.Caching.Queue/PublicAPI.Unshipped.txt +++ b/src/UiPath.Caching.Queue/PublicAPI.Unshipped.txt @@ -1,9 +1,52 @@ #nullable enable -UiPath.Caching.InMemoryQueueCacheProvider.InMemoryQueueCacheProvider(Microsoft.Extensions.Options.IOptions! optionsAccessor, UiPath.Caching.IMemoryCacheFactory! memoryCacheFactory, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Locking.ILocalLock! localLock) -> void *REMOVED*UiPath.Caching.InMemoryQueueCacheProvider.InMemoryQueueCacheProvider(Microsoft.Extensions.Options.IOptions! optionsAccessor, UiPath.Caching.IMemoryCacheFactory! memoryCacheFactory, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Locking.ILocalLock! localLock) -> void -UiPath.Caching.InMemoryRedisQueueCacheProvider.InMemoryRedisQueueCacheProvider(Microsoft.Extensions.Options.IOptions! optionsAccessor, UiPath.Caching.IMemoryCacheFactory! memoryCacheFactory, System.Func! queueCacheFactoryAccessor, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Locking.ILocalLock! localLock) -> void *REMOVED*UiPath.Caching.InMemoryRedisQueueCacheProvider.InMemoryRedisQueueCacheProvider(Microsoft.Extensions.Options.IOptions! optionsAccessor, UiPath.Caching.IMemoryCacheFactory! memoryCacheFactory, System.Func! queueCacheFactoryAccessor, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Locking.ILocalLock! localLock) -> void -UiPath.Caching.Redis.RedisSetCache.RedisSetCache(UiPath.Caching.Redis.IRedisConnector! redis, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Policies.IResiliencePipelineProvider! resiliencePipelineProvider, UiPath.Caching.Telemetry.ICachingTelemetryProvider! telemetryProvider, UiPath.Caching.Redis.RedisCacheOptions! redisCacheOptions, UiPath.Caching.CacheOptions! cacheOptions, UiPath.Caching.Redis.RedisSetCacheOptions! setCacheOptions, UiPath.Caching.ICachePolicyFactory! policyFactory, Microsoft.Extensions.Logging.ILogger! logger) -> void *REMOVED*UiPath.Caching.Redis.RedisSetCache.RedisSetCache(UiPath.Caching.Redis.IRedisConnector! redis, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Policies.IResiliencePipelineProvider! resiliencePipelineProvider, UiPath.Caching.Telemetry.ICachingTelemetryProvider! telemetryProvider, UiPath.Caching.Redis.RedisCacheOptions! redisCacheOptions, UiPath.Caching.CacheOptions! cacheOptions, UiPath.Caching.Redis.RedisSetCacheOptions! setCacheOptions, UiPath.Caching.ICachePolicyFactory! policyFactory, Microsoft.Extensions.Logging.ILogger! logger) -> void -UiPath.Caching.RedisQueueCacheProvider.RedisQueueCacheProvider(Microsoft.Extensions.Options.IOptions! redisCacheOptions, Microsoft.Extensions.Options.IOptions! cacheOptions, Microsoft.Extensions.Options.IOptions! setCacheOptions, UiPath.Caching.Redis.IRedisConnector! redis, UiPath.Caching.ISerializerProxy! serializerProxy, UiPath.Caching.Policies.IResiliencePipelineProvider! resiliencePipelineProvider, UiPath.Caching.Telemetry.ICachingTelemetryProvider! cachingTelemetryProvider, Microsoft.Extensions.Logging.ILoggerFactory! loggerFactory, UiPath.Caching.ICachePolicyFactory! policyFactory) -> void *REMOVED*UiPath.Caching.RedisQueueCacheProvider.RedisQueueCacheProvider(Microsoft.Extensions.Options.IOptions! redisCacheOptions, Microsoft.Extensions.Options.IOptions! cacheOptions, Microsoft.Extensions.Options.IOptions! setCacheOptions, UiPath.Caching.Redis.IRedisConnector! redis, UiPath.Caching.ISerializerProxy! serializerProxy, UiPath.Caching.Policies.IResiliencePipelineProvider! resiliencePipelineProvider, UiPath.Caching.Telemetry.ICachingTelemetryProvider! cachingTelemetryProvider, Microsoft.Extensions.Logging.ILoggerFactory! loggerFactory, UiPath.Caching.ICachePolicyFactory! policyFactory) -> void +UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ISetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ISetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.ISetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.InMemoryQueueCacheProvider.InMemoryQueueCacheProvider(Microsoft.Extensions.Options.IOptions! optionsAccessor, UiPath.Caching.IMemoryCacheFactory! memoryCacheFactory, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Locking.ILocalLock! localLock) -> void +UiPath.Caching.InMemoryRedisQueueCacheProvider.InMemoryRedisQueueCacheProvider(Microsoft.Extensions.Options.IOptions! optionsAccessor, UiPath.Caching.IMemoryCacheFactory! memoryCacheFactory, System.Func! queueCacheFactoryAccessor, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Locking.ILocalLock! localLock) -> void +UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullSetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.NullSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.NullSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.Redis.RedisSetCache.AddAsync(UiPath.Caching.CacheKey cacheKey, T item, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.Redis.RedisSetCache.MembersAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.Redis.RedisSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +UiPath.Caching.Redis.RedisSetCache.PopAsync(UiPath.Caching.CacheKey cacheKey, long count, UiPath.Caching.CachePolicy? policy, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +UiPath.Caching.Redis.RedisSetCache.RedisSetCache(UiPath.Caching.Redis.IRedisConnector! redis, UiPath.Caching.ISerializerProxy! serializer, UiPath.Caching.Policies.IResiliencePipelineProvider! resiliencePipelineProvider, UiPath.Caching.Telemetry.ICachingTelemetryProvider! telemetryProvider, UiPath.Caching.Redis.RedisCacheOptions! redisCacheOptions, UiPath.Caching.CacheOptions! cacheOptions, UiPath.Caching.Redis.RedisSetCacheOptions! setCacheOptions, UiPath.Caching.ICachePolicyFactory! policyFactory, Microsoft.Extensions.Logging.ILogger! logger) -> void +UiPath.Caching.RedisQueueCacheProvider.RedisQueueCacheProvider(Microsoft.Extensions.Options.IOptions! redisCacheOptions, Microsoft.Extensions.Options.IOptions! cacheOptions, Microsoft.Extensions.Options.IOptions! setCacheOptions, UiPath.Caching.Redis.IRedisConnector! redis, UiPath.Caching.ISerializerProxy! serializerProxy, UiPath.Caching.Policies.IResiliencePipelineProvider! resiliencePipelineProvider, UiPath.Caching.Telemetry.ICachingTelemetryProvider! cachingTelemetryProvider, Microsoft.Extensions.Logging.ILoggerFactory! loggerFactory, UiPath.Caching.ICachePolicyFactory! policyFactory) -> void +UiPath.Caching.SetCacheExtensions +UiPath.Caching.SetCacheSyncExtensions +static UiPath.Caching.SetCacheExtensions.AddAsync(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.SetCacheExtensions.AddAsync(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.SetCacheExtensions.AddAsync(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.SetCacheExtensions.AddAsync(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.SetCacheExtensions.MembersAsync(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.SetCacheExtensions.PopAsync(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask +static UiPath.Caching.SetCacheExtensions.PopAsync(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, long count, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask!> +static UiPath.Caching.SetCacheSyncExtensions.Add(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.DateTimeOffset? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long +static UiPath.Caching.SetCacheSyncExtensions.Add(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long +static UiPath.Caching.SetCacheSyncExtensions.Add(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.TimeSpan? expiration, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long +static UiPath.Caching.SetCacheSyncExtensions.Add(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.SetCacheSyncExtensions.Contains(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.SetCacheSyncExtensions.ContainsItem(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.SetCacheSyncExtensions.Count(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long +static UiPath.Caching.SetCacheSyncExtensions.Members(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IReadOnlyCollection! +static UiPath.Caching.SetCacheSyncExtensions.Pop(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> T? +static UiPath.Caching.SetCacheSyncExtensions.Pop(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, long count, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IReadOnlyCollection! +static UiPath.Caching.SetCacheSyncExtensions.Remove(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.SetCacheSyncExtensions.RemoveItem(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, T item, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> bool +static UiPath.Caching.SetCacheSyncExtensions.RemoveItems(this UiPath.Caching.ISetCache! cache, UiPath.Caching.CacheKey cacheKey, System.Collections.Generic.IEnumerable! items, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) -> long diff --git a/src/UiPath.Caching.Queue/RedisSetCache.cs b/src/UiPath.Caching.Queue/RedisSetCache.cs index 08c27449..8505cd3e 100644 --- a/src/UiPath.Caching.Queue/RedisSetCache.cs +++ b/src/UiPath.Caching.Queue/RedisSetCache.cs @@ -38,7 +38,7 @@ public RedisSetCache( public string Name => KnownCacheProviderNames.Redis; - public async ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var value = _serializer.Serialize(item); @@ -46,10 +46,10 @@ public async ValueTask AddAsync(CacheKey cacheKey, T item, CachePolicy? return added > 0; } - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, CachePolicy? policy, CancellationToken token = default) => AddAsync(cacheKey, items, expiration: (TimeSpan?)null, policy, token); - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); ArgumentNullException.ThrowIfNull(items); @@ -57,7 +57,7 @@ public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, Time return AddManyInnerAsync(cacheKey, values, Clock.ToDateTimeOffset(ResolveExpiration(expiration, policy)), token); } - public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask AddAsync(CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); ArgumentNullException.ThrowIfNull(items); @@ -121,7 +121,7 @@ private async ValueTask AddManyInnerAsync(CacheKey cacheKey, RedisValue return ret; } - public async ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask PopAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var redisKey = ToRedisKey(cacheKey, token); @@ -160,7 +160,7 @@ private async ValueTask AddManyInnerAsync(CacheKey cacheKey, RedisValue return ret; } - public async ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> PopAsync(CacheKey cacheKey, long count, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); if (count <= 0) @@ -199,7 +199,7 @@ private async ValueTask AddManyInnerAsync(CacheKey cacheKey, RedisValue return ret; } - public async ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> MembersAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var redisKey = ToRedisKey(cacheKey, token); diff --git a/src/UiPath.Caching.Queue/SetCacheExtensions.cs b/src/UiPath.Caching.Queue/SetCacheExtensions.cs new file mode 100644 index 00000000..69cf8cb9 --- /dev/null +++ b/src/UiPath.Caching.Queue/SetCacheExtensions.cs @@ -0,0 +1,39 @@ +namespace UiPath.Caching; + +/// +/// Source-compatibility overloads for pre-CachePolicy call sites. Each forwards to the +/// policy-bearing member with policy: null. +/// +// Excluded from coverage — forwarders with no behavior of their own; the policy-bearing impls +// are what tests exercise. +[ExcludeFromCodeCoverage] +public static class SetCacheExtensions +{ + /// + public static ValueTask AddAsync(this ISetCache cache, CacheKey cacheKey, T item, CancellationToken token = default) + => cache.AddAsync(cacheKey, item, (CachePolicy?)null, token); + + /// + public static ValueTask AddAsync(this ISetCache cache, CacheKey cacheKey, IEnumerable items, CancellationToken token = default) + => cache.AddAsync(cacheKey, items, (CachePolicy?)null, token); + + /// + public static ValueTask AddAsync(this ISetCache cache, CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CancellationToken token = default) + => cache.AddAsync(cacheKey, items, expiration, null, token); + + /// + public static ValueTask AddAsync(this ISetCache cache, CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CancellationToken token = default) + => cache.AddAsync(cacheKey, items, expiration, null, token); + + /// + public static ValueTask PopAsync(this ISetCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.PopAsync(cacheKey, (CachePolicy?)null, token); + + /// + public static ValueTask> PopAsync(this ISetCache cache, CacheKey cacheKey, long count, CancellationToken token = default) + => cache.PopAsync(cacheKey, count, null, token); + + /// + public static ValueTask> MembersAsync(this ISetCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.MembersAsync(cacheKey, (CachePolicy?)null, token); +} diff --git a/src/UiPath.Caching.Queue/SetCacheSyncExtensions.cs b/src/UiPath.Caching.Queue/SetCacheSyncExtensions.cs new file mode 100644 index 00000000..33b27b07 --- /dev/null +++ b/src/UiPath.Caching.Queue/SetCacheSyncExtensions.cs @@ -0,0 +1,57 @@ +namespace UiPath.Caching; + +/// +/// Blocking forwarders over the async API. Each blocks on the +/// underlying call via .AsTask().GetAwaiter().GetResult() — use only from sync call sites +/// that can tolerate the thread-blocking cost. +/// +// Excluded from coverage — forwarders with no behavior of their own; the async impls are what +// tests exercise. +[ExcludeFromCodeCoverage] +public static class SetCacheSyncExtensions +{ + /// + public static bool Add(this ISetCache cache, CacheKey cacheKey, T item, CancellationToken token = default) + => cache.AddAsync(cacheKey, item, token).AsTask().GetAwaiter().GetResult(); + + /// + public static long Add(this ISetCache cache, CacheKey cacheKey, IEnumerable items, CancellationToken token = default) + => cache.AddAsync(cacheKey, items, token).AsTask().GetAwaiter().GetResult(); + + /// + public static long Add(this ISetCache cache, CacheKey cacheKey, IEnumerable items, TimeSpan? expiration, CancellationToken token = default) + => cache.AddAsync(cacheKey, items, expiration, token).AsTask().GetAwaiter().GetResult(); + + /// + public static long Add(this ISetCache cache, CacheKey cacheKey, IEnumerable items, DateTimeOffset? expiration, CancellationToken token = default) + => cache.AddAsync(cacheKey, items, expiration, token).AsTask().GetAwaiter().GetResult(); + + /// + public static T? Pop(this ISetCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.PopAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + /// + public static IReadOnlyCollection Pop(this ISetCache cache, CacheKey cacheKey, long count, CancellationToken token = default) + => cache.PopAsync(cacheKey, count, token).AsTask().GetAwaiter().GetResult(); + + public static IReadOnlyCollection Members(this ISetCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.MembersAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool ContainsItem(this ISetCache cache, CacheKey cacheKey, T item, CancellationToken token = default) + => cache.ContainsItemAsync(cacheKey, item, token).AsTask().GetAwaiter().GetResult(); + + public static long Count(this ISetCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.CountAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool RemoveItem(this ISetCache cache, CacheKey cacheKey, T item, CancellationToken token = default) + => cache.RemoveItemAsync(cacheKey, item, token).AsTask().GetAwaiter().GetResult(); + + public static long RemoveItems(this ISetCache cache, CacheKey cacheKey, IEnumerable items, CancellationToken token = default) + => cache.RemoveItemsAsync(cacheKey, items, token).AsTask().GetAwaiter().GetResult(); + + public static bool Remove(this ISetCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.RemoveAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); + + public static bool Contains(this ISetCache cache, CacheKey cacheKey, CancellationToken token = default) + => cache.ContainsAsync(cacheKey, token).AsTask().GetAwaiter().GetResult(); +} diff --git a/src/UiPath.Caching/MultilayerCache.cs b/src/UiPath.Caching/MultilayerCache.cs index 93b9edef..43532673 100644 --- a/src/UiPath.Caching/MultilayerCache.cs +++ b/src/UiPath.Caching/MultilayerCache.cs @@ -33,14 +33,14 @@ public MultilayerCache( _localMemorySetter = new LocalMemorySetter(cacheName, changeTokenFactory, _topicProvider, _memoryCache, logger, _clock, _multiLayerCacheOptions, memoryCacheOptions, telemetryProvider); } - public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; return GetInnerAsync(_entryBuilder.BuildEntryOptions(cacheKey, _clock.ToDateTimeOffset(_multiLayerCacheOptions.DefaultExpiration), token), policy); } - public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -48,7 +48,7 @@ public MultilayerCache( return GetInnerAsync(options, policy, token); } - public async ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -56,7 +56,7 @@ public MultilayerCache( return await GetCacheEntryInnerAsync(options, policy).ConfigureAwait(false); } - public async ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -64,7 +64,7 @@ public MultilayerCache( return await GetCacheEntriesInnerAsync(options, policy, token).ConfigureAwait(false); } - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy, CancellationToken token = default) { ArgumentNullException.ThrowIfNull(generator); policy ??= _defaultPolicy; @@ -73,7 +73,7 @@ public MultilayerCache( return GetOrAddInternalAsync(cacheKey, generator, writeExpiration, duration, policy, token); } - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { ArgumentNullException.ThrowIfNull(generator); policy ??= _defaultPolicy; @@ -81,7 +81,7 @@ public MultilayerCache( return GetOrAddInternalAsync(cacheKey, generator, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), duration, policy, token); } - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { ArgumentNullException.ThrowIfNull(generator); policy ??= _defaultPolicy; @@ -99,7 +99,7 @@ public MultilayerCache( return GetOrAddInternalAsync(cacheKey, generator, expiration, duration, policy, token); } - public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, CachePolicy? policy, CancellationToken token = default) where TState : notnull { ArgumentNullException.ThrowIfNull(entries); @@ -110,7 +110,7 @@ public MultilayerCache( return GetOrAddBatchInternalAsync(entries, generator, writeExpiration, duration, policy, token); } - public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) where TState : notnull { ArgumentNullException.ThrowIfNull(entries); @@ -120,7 +120,7 @@ public MultilayerCache( return GetOrAddBatchInternalAsync(entries, generator, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), duration, policy, token); } - public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) where TState : notnull { ArgumentNullException.ThrowIfNull(entries); @@ -619,19 +619,19 @@ private List> SelectEntriesToStore( return results; } - public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return SetAsync(cacheKey, value, ResolveWriteDuration(policy), policy, token); } - public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return SetAsync(cacheKey, value, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), policy, token); } - public async ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -656,13 +656,13 @@ public async ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOf } } - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return TryAddAsync(cacheKey, value, ResolveWriteDuration(policy), policy, token); } - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return TryAddAsync(cacheKey, value, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), policy, token); @@ -680,7 +680,7 @@ public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? exp /// GetInnerCacheDisconnected, whose state also covers the broadcast transport: a dead /// topic must not stop a healthy Redis. /// - public async ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -775,19 +775,19 @@ private async ValueTask TryAddUnderLocalLockAsync(CacheEntryOptions opt return true; } - public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return SetAsync(keyValues, ResolveWriteDuration(policy), policy, token); } - public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return SetAsync(keyValues, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), policy, token); } - public async ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -857,19 +857,19 @@ public ValueTask RemoveAsync(CacheKey[] cacheKey, CancellationToken tok return RemoveAsync(options, token); } - public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return RefreshAsync(cacheKey, ResolveWriteDuration(policy), policy, token); } - public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return RefreshAsync(cacheKey, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), policy, token); } - public async ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; diff --git a/src/UiPath.Caching/MultilayerHashCache.cs b/src/UiPath.Caching/MultilayerHashCache.cs index 1622aaf6..634837dc 100644 --- a/src/UiPath.Caching/MultilayerHashCache.cs +++ b/src/UiPath.Caching/MultilayerHashCache.cs @@ -34,7 +34,7 @@ public MultilayerHashCache( _localMemorySetter = new HashLocalMemorySetter(cacheName, changeTokenFactory, _topicProvider, _memoryCache, logger, _clock, _multiLayerCacheOptions, memoryCacheOptions, telemetryProvider); } - public async ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -47,7 +47,7 @@ public MultilayerHashCache( return cacheEntry.Value.TryGetValue(field, out var value) ? value : default; } - public async ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -55,7 +55,7 @@ public MultilayerHashCache( return cacheEntry.Value ?? Empty(); } - public async ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -63,14 +63,14 @@ public MultilayerHashCache( return cacheEntry?.Value ?? Empty(); } - public ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; return GetCacheEntryAsync(_entryBuilder.BuildEntryOptions(cacheKey, token), policy); } - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy, CancellationToken token = default) { ArgumentNullException.ThrowIfNull(generator); policy ??= _defaultPolicy; @@ -79,7 +79,7 @@ public MultilayerHashCache( return GetOrAddInternalAsync(cacheKey, generator, writeExpiration, duration, HashCacheSetOption.KeyReplace, policy, token); } - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { ArgumentNullException.ThrowIfNull(generator); policy ??= _defaultPolicy; @@ -87,7 +87,7 @@ public MultilayerHashCache( return GetOrAddInternalAsync(cacheKey, generator, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), duration, HashCacheSetOption.KeyReplace, policy, token); } - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { ArgumentNullException.ThrowIfNull(generator); policy ??= _defaultPolicy; @@ -112,7 +112,7 @@ public MultilayerHashCache( /// _metadata_-as-empty-marker is present; we collapse that to for the /// caller, who can always iterate the result without a null check. /// - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, HashCacheSetOption? setOption = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, HashCacheSetOption? setOption, CachePolicy? policy, CancellationToken token = default) { ArgumentNullException.ThrowIfNull(generator); policy ??= _defaultPolicy; @@ -207,19 +207,19 @@ private void TryHashRehydrate(CacheKey originalCacheKey, DateTimeOffset entry return _cacheEntryFactory.Create>(ret ?? Empty(), cacheEntryOptions.Expiration, cacheEntryOptions.Metadata); } - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return SetAsync(cacheKey, values, ResolveWriteDuration(policy), policy, token); } - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return SetAsync(cacheKey, values, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), policy, token); } - public async ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -246,7 +246,7 @@ public async ValueTask SetAsync(CacheKey cacheKey, IDictionary SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; @@ -290,22 +290,22 @@ public ValueTask RemoveAsync(CacheKey cacheKey, CancellationToken token return RemoveAsync(_entryBuilder.BuildEntryOptions(cacheKey, default, token: token)); } - public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return RefreshAsync(cacheKey, ResolveWriteDuration(policy), policy, token); } - public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { policy ??= _defaultPolicy; return RefreshAsync(cacheKey, _clock.ToDateTimeOffset(ResolveWriteDuration(policy, expiration)), policy, token); } - public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => RefreshAsync(cacheKey, new HashCacheEntryOptions(expiration), policy, token); - public async ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); policy ??= _defaultPolicy; diff --git a/src/UiPath.Caching/Redis/RedisCache.cs b/src/UiPath.Caching/Redis/RedisCache.cs index 42223727..ddb7be1d 100644 --- a/src/UiPath.Caching/Redis/RedisCache.cs +++ b/src/UiPath.Caching/Redis/RedisCache.cs @@ -46,37 +46,37 @@ public RedisCache( public string Name => KnownCacheProviderNames.Redis; - public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return GetAsync(ToRedisKey(cacheKey, token), token); } - public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return GetAsyncInternal(cacheKeys, token); } - public ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return GetCacheEntryInternalAsync(cacheKey, token); } - public ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask>[]> GetCacheEntriesAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return GetCacheEntriesInternalAsync(cacheKeys, token); } - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy, CancellationToken token = default) => GetOrAddAsync(cacheKey, generator, expiration: (TimeSpan?)null, policy, token); - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => GetOrAddAsync(cacheKey, generator, expiration is { } d ? d.Subtract(Clock.UtcNow) : (TimeSpan?)null, policy, token); - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); ArgumentNullException.ThrowIfNull(generator); @@ -87,7 +87,7 @@ public RedisCache( } /// - public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, CachePolicy? policy, CancellationToken token = default) where TState : notnull { ArgumentNullException.ThrowIfNull(generator); @@ -96,7 +96,7 @@ public RedisCache( } /// - public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) where TState : notnull { ArgumentNullException.ThrowIfNull(generator); @@ -105,7 +105,7 @@ public RedisCache( } /// - public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask[]> GetOrAddAsync(KeyValuePair[] entries, Func[]>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) where TState : notnull { ArgumentNullException.ThrowIfNull(generator); @@ -141,13 +141,13 @@ public RedisCache( token); } - public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => RefreshAsync(cacheKey, expiration: (TimeSpan?)null, policy, token); - public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => RefreshAsync(cacheKey, Clock.ToDateTimeOffset(ResolveExpiration(expiration, policy)), policy, token); - public async ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var redisKey = ToRedisKey(cacheKey, token); @@ -200,54 +200,54 @@ public ValueTask RemoveAsync(CacheKey[] cacheKey, CancellationToken tok return RemoveAsync(cacheKey.Select(k => ToRedisKey(k, token)).ToArray(), token); } - public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) => SetAsync(cacheKey, value, expiration: (TimeSpan?)null, policy, token); - public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var effective = ResolveExpiration(expiration, policy); return SetInternalAsync(ToRedisKey(cacheKey, token), value, Clock.ToTimeSpan(effective), token); } - public ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var effective = ResolveExpiration(expiration, policy); return SetInternalAsync(ToRedisKey(cacheKey, token), value, Clock.ToTimeSpan(effective), token); } - public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return SetAsync(keyValues, expiration: (TimeSpan?)null, policy, token); } - public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var effective = ResolveExpiration(expiration, policy); return SetInternalAsync(keyValues, Clock.ToTimeSpan(effective), token); } - public ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var effective = ResolveExpiration(expiration, policy); return SetInternalAsync(keyValues, Clock.ToTimeSpan(effective), token); } - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) => TryAddAsync(cacheKey, value, expiration: (TimeSpan?)null, policy, token); - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var effective = ResolveExpiration(expiration, policy); return TryAddInternalAsync(ToRedisKey(cacheKey, token), value, Clock.ToTimeSpan(effective), token); } - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var effective = ResolveExpiration(expiration, policy); diff --git a/src/UiPath.Caching/Redis/RedisHashCache.cs b/src/UiPath.Caching/Redis/RedisHashCache.cs index 206c412d..3ac2e9bf 100644 --- a/src/UiPath.Caching/Redis/RedisHashCache.cs +++ b/src/UiPath.Caching/Redis/RedisHashCache.cs @@ -46,41 +46,41 @@ public RedisHashCache( public string Name => KnownCacheProviderNames.Redis; - public async ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask GetItemAsync(CacheKey cacheKey, string field, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); ValidateFieldForRead(field); return await GetInnerAsync(cacheKey, field, token); } - public async ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return await GetInnerAsync(cacheKey, token); } - public async ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> GetAsync(CacheKey cacheKey, string[] fields, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return await GetInnerAsync(cacheKey, fields, token); } - public async ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask>> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); return await GetInnerCacheEntryAsync(cacheKey, token); } - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, CachePolicy? policy, CancellationToken token = default) => GetOrAddAsync(cacheKey, generator, expiration: (TimeSpan?)null, policy, token); - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => GetOrAddAsync(cacheKey, generator, Clock.ToDateTimeOffset(ResolveExpiration(expiration, policy)), HashCacheSetOption.KeyReplace, policy, token); - public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => GetOrAddAsync(cacheKey, generator, expiration, HashCacheSetOption.KeyReplace, policy, token); - public async ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration = null, HashCacheSetOption? setOption = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask> GetOrAddAsync(CacheKey cacheKey, Func>> generator, DateTimeOffset? expiration, HashCacheSetOption? setOption, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); ArgumentNullException.ThrowIfNull(generator); @@ -224,13 +224,13 @@ public async ValueTask ContainsAsync(CacheKey cacheKey, CancellationTok return ret; } - public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => RefreshAsync(cacheKey, expiration: (TimeSpan?)null, policy, token); - public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => RefreshAsync(cacheKey, Clock.ToDateTimeOffset(ResolveExpiration(expiration, policy)), policy, token); - public async ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var redisKey = ToRedisKey(cacheKey, token); @@ -266,7 +266,7 @@ public async ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? return ret; } - public async ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default) + public async ValueTask RefreshAsync(CacheKey cacheKey, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); var redisKey = ToRedisKey(cacheKey, token); @@ -379,13 +379,13 @@ public async ValueTask RemoveAsync(CacheKey cacheKey, CancellationToken return ret; } - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, CachePolicy? policy, CancellationToken token = default) => SetAsync(cacheKey, values, expiration: (TimeSpan?)null, policy, token); - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => SetAsync(cacheKey, values, Clock.ToDateTimeOffset(ResolveExpiration(expiration, policy)), policy, token); - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); ValidateForWrite(values); @@ -400,7 +400,7 @@ public ValueTask SetAsync(CacheKey cacheKey, IDictionary va return SetInnerAsync(redisKey, hashEntries, HashCacheSetOption.KeyReplace, effective, token); } - public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(CacheKey cacheKey, IDictionary values, HashCacheEntryOptions options, CachePolicy? policy, CancellationToken token = default) { NotCacheableException.ThrowIfNotCacheable(); ValidateForWrite(values); diff --git a/tests/UiPath.Caching.Tests/Broadcast/RedisStreamSubjectWriterTests.cs b/tests/UiPath.Caching.Tests/Broadcast/RedisStreamSubjectWriterTests.cs index 688d5802..2f75a9c7 100644 --- a/tests/UiPath.Caching.Tests/Broadcast/RedisStreamSubjectWriterTests.cs +++ b/tests/UiPath.Caching.Tests/Broadcast/RedisStreamSubjectWriterTests.cs @@ -314,9 +314,14 @@ public async Task Unknown_command_quarantine_is_lifted_when_the_connection_recon } }; + // Read through Volatile, like `attempts` above: this flag is written by the test thread and + // read by the fetch loop's thread, so a plain capture is a data race. Closing it does not + // fully de-flake this test — it was still seen failing under parallel load afterwards, with + // `recovered` false after the 10s budget — but an unsynchronized cross-thread flag is not + // something to leave in place while chasing that. var fail = true; _database.StreamReadGroupAsync(_context.Topic, _context.ConsumerGroup, _context.ConsumerName, ">", _context.PollBatchSize) - .ReturnsForAnyArgs(_ => fail + .ReturnsForAnyArgs(_ => Volatile.Read(ref fail) ? throw UnknownCommandError("ERR unknown command 'XREADGROUP'") : Task.FromResult(Array.Empty())); @@ -340,7 +345,8 @@ public async Task Unknown_command_quarantine_is_lifted_when_the_connection_recon await loggedCritical.Task.WaitAsync(WaitTimeout, TestContext.Current.CancellationToken); // Server now answers XREADGROUP; the reconnect must wake the loop instead of waiting out the backoff. - fail = false; + // Written before the release below, so a thread that observes the release also observes this. + Volatile.Write(ref fail, false); connectionState.OnReconnected += Raise.Event(connectionState, EventArgs.Empty); var recovered = await WaitUntil(() => recordingLogger.Records.Any( diff --git a/tests/UiPath.Caching.Tests/Fakes/DictionaryCache.cs b/tests/UiPath.Caching.Tests/Fakes/DictionaryCache.cs index 26f1529d..fd6cd449 100644 --- a/tests/UiPath.Caching.Tests/Fakes/DictionaryCache.cs +++ b/tests/UiPath.Caching.Tests/Fakes/DictionaryCache.cs @@ -24,7 +24,7 @@ internal sealed class DictionaryCache : ICache public T? Read(CacheKey key) => _store.TryGetValue(key, out var v) ? (T?)v : default; public ValueTask>[]> GetCacheEntriesAsync( - CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) + CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) { GetCacheEntriesCalls++; var results = cacheKeys @@ -37,7 +37,7 @@ internal sealed class DictionaryCache : ICache return ValueTask.FromResult(results); } - public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask SetAsync(KeyValuePair[] keyValues, CachePolicy? policy, CancellationToken token = default) { SetCalls++; SetKeySets.Add(keyValues.Select(kv => kv.Key).ToArray()); @@ -53,42 +53,42 @@ public ValueTask SetAsync(KeyValuePair[] keyValues, Cache return ValueTask.FromResult(true); } - public ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask> GetCacheEntryAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => ValueTask.FromResult>(_store.TryGetValue(cacheKey, out var v) ? new TestCacheEntry { Value = (T?)v, Expiration = DateTimeOffset.MaxValue, Found = true } : new TestCacheEntry { Value = default, Expiration = DateTimeOffset.MinValue }); - public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => ValueTask.FromResult(Read(cacheKey)); - public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask[]> GetAsync(CacheKey[] cacheKeys, CachePolicy? policy, CancellationToken token = default) => ValueTask.FromResult(cacheKeys.Select(k => new KeyValuePair(k, Read(k))).ToArray()); - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, CachePolicy? policy, CancellationToken token = default) => throw new NotSupportedException(); - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => throw new NotSupportedException(); - public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask GetOrAddAsync(CacheKey cacheKey, Func> generator, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => throw new NotSupportedException(); - public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) => SetAsync([new KeyValuePair(cacheKey, value)], policy, token); - public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => SetAsync([new KeyValuePair(cacheKey, value)], policy, token); - public ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => SetAsync([new KeyValuePair(cacheKey, value)], policy, token); - public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(KeyValuePair[] keyValues, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => SetAsync(keyValues, policy, token); - public ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask SetAsync(KeyValuePair[] keyValues, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => SetAsync(keyValues, policy, token); - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy = null, CancellationToken token = default) + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? policy, CancellationToken token = default) { TryAddCalls++; if (value is null && !CacheNullValues) @@ -98,10 +98,10 @@ public ValueTask TryAddAsync(CacheKey cacheKey, T? value, CachePolicy? return ValueTask.FromResult(_store.TryAdd(cacheKey, value)); } - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => TryAddAsync(cacheKey, value, policy, token); - public ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => + public ValueTask TryAddAsync(CacheKey cacheKey, T? value, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => TryAddAsync(cacheKey, value, policy, token); public ValueTask RemoveAsync(CacheKey cacheKey, CancellationToken token = default) => @@ -113,11 +113,11 @@ public ValueTask RemoveAsync(CacheKey[] cacheKey, CancellationToken tok return ValueTask.FromResult(true); } - public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy = null, CancellationToken token = default) => ValueTask.FromResult(true); + public ValueTask RefreshAsync(CacheKey cacheKey, CachePolicy? policy, CancellationToken token = default) => ValueTask.FromResult(true); - public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ValueTask.FromResult(true); + public ValueTask RefreshAsync(CacheKey cacheKey, TimeSpan? expiration, CachePolicy? policy, CancellationToken token = default) => ValueTask.FromResult(true); - public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration = null, CachePolicy? policy = null, CancellationToken token = default) => ValueTask.FromResult(true); + public ValueTask RefreshAsync(CacheKey cacheKey, DateTimeOffset? expiration, CachePolicy? policy, CancellationToken token = default) => ValueTask.FromResult(true); public ValueTask ContainsAsync(CacheKey cacheKey, CancellationToken token = default) => ValueTask.FromResult(_store.ContainsKey(cacheKey)); diff --git a/tests/UiPath.Caching.Tests/MultilayerCachePerNameFactoryTimeoutTests.cs b/tests/UiPath.Caching.Tests/MultilayerCachePerNameFactoryTimeoutTests.cs index b3c8ff28..b421fe32 100644 --- a/tests/UiPath.Caching.Tests/MultilayerCachePerNameFactoryTimeoutTests.cs +++ b/tests/UiPath.Caching.Tests/MultilayerCachePerNameFactoryTimeoutTests.cs @@ -42,6 +42,11 @@ public async Task GetOrAdd_with_null_FactoryTimeout_runs_generator_to_completion [Fact] public async Task GetOrAdd_with_FactoryTimeout_throws_TimeoutException_when_generator_exceeds_budget() { + // FactoryTimeout only surfaces as TimeoutException while the caller's own token is + // uncancelled — see the catch filter in FactoryTimeout.RunAsync. Pass a token this test + // owns rather than the ambient one the runner may cancel under load; the 50ms budget is + // what bounds the call, so nothing here can hang. + using var caller = new CancellationTokenSource(); var policy = new CachePolicy { FactoryTimeout = TimeSpan.FromMilliseconds(50) }; Func> generator = async ct => { @@ -49,7 +54,7 @@ public async Task GetOrAdd_with_FactoryTimeout_throws_TimeoutException_when_gene return "v"; }; - var act = async () => await Sut.GetOrAddAsync(_cacheKey, generator, policy, testContextAccessor.Current.CancellationToken); + var act = async () => await Sut.GetOrAddAsync(_cacheKey, generator, policy, caller.Token); await act.Should().ThrowAsync(); } diff --git a/tests/UiPath.Caching.Tests/MultilayerHashCachePerNameFactoryTimeoutTests.cs b/tests/UiPath.Caching.Tests/MultilayerHashCachePerNameFactoryTimeoutTests.cs index 7ca6aa08..88d4f3a5 100644 --- a/tests/UiPath.Caching.Tests/MultilayerHashCachePerNameFactoryTimeoutTests.cs +++ b/tests/UiPath.Caching.Tests/MultilayerHashCachePerNameFactoryTimeoutTests.cs @@ -42,6 +42,11 @@ public async Task GetOrAdd_with_null_FactoryTimeout_runs_generator_to_completion [Fact] public async Task GetOrAdd_with_FactoryTimeout_throws_TimeoutException_when_generator_exceeds_budget() { + // FactoryTimeout only surfaces as TimeoutException while the caller's own token is + // uncancelled — see the catch filter in FactoryTimeout.RunAsync. Pass a token this test + // owns rather than the ambient one the runner may cancel under load; the 50ms budget is + // what bounds the call, so nothing here can hang. + using var caller = new CancellationTokenSource(); var policy = new CachePolicy { FactoryTimeout = TimeSpan.FromMilliseconds(50) }; Func>> generator = async ct => { @@ -49,7 +54,7 @@ public async Task GetOrAdd_with_FactoryTimeout_throws_TimeoutException_when_gene return new Dictionary { ["f"] = "v" }; }; - var act = async () => await Sut.GetOrAddAsync(_cacheKey, generator, policy, testContextAccessor.Current.CancellationToken); + var act = async () => await Sut.GetOrAddAsync(_cacheKey, generator, policy, caller.Token); await act.Should().ThrowAsync(); } diff --git a/tests/UiPath.Caching.Tests/Redis/RedisCacheTests.cs b/tests/UiPath.Caching.Tests/Redis/RedisCacheTests.cs index 5a96d7c7..b9bed98a 100644 --- a/tests/UiPath.Caching.Tests/Redis/RedisCacheTests.cs +++ b/tests/UiPath.Caching.Tests/Redis/RedisCacheTests.cs @@ -755,6 +755,11 @@ await _database.Received(1).StringSetAsync( [Fact] public async Task GetOrAdd_policy_FactoryTimeout_cancels_slow_generator() { + // FactoryTimeout only surfaces as TimeoutException while the caller's own token is + // uncancelled — see the catch filter in FactoryTimeout.RunAsync. Pass a token this test + // owns rather than the ambient one the runner may cancel under load; the 50ms budget is + // what bounds the call, so nothing here can hang. + using var caller = new CancellationTokenSource(); var policy = new CachePolicy { FactoryTimeout = TimeSpan.FromMilliseconds(50) }; Func> generator = async ct => { @@ -762,7 +767,7 @@ public async Task GetOrAdd_policy_FactoryTimeout_cancels_slow_generator() return "never"; }; - var act = async () => await Sut.GetOrAddAsync(_cacheKey, generator, policy: policy, token: testContextAccessor.Current.CancellationToken); + var act = async () => await Sut.GetOrAddAsync(_cacheKey, generator, policy: policy, token: caller.Token); await act.Should().ThrowAsync(); } @@ -771,6 +776,12 @@ public async Task GetOrAdd_policy_FactoryTimeout_cancels_slow_generator() public async Task Batch_GetOrAdd_policy_FactoryTimeout_cancels_slow_generator() { var token = testContextAccessor.Current.CancellationToken; + // FactoryTimeout only surfaces as TimeoutException while the caller's own token is + // uncancelled — see the catch filter in FactoryTimeout.RunAsync. Pass a token this test + // owns rather than the ambient one the runner may cancel under load; the 50ms budget is + // what bounds the call, so nothing here can hang. The ambient token still guards the race + // below. + using var caller = new CancellationTokenSource(); var policy = new CachePolicy { FactoryTimeout = TimeSpan.FromMilliseconds(50) }; var entries = new KeyValuePair[] { new(_cacheKey, "one"), new(_multiKey, "two") }; static async Task[]> Generator(string[] _, CancellationToken ct) @@ -779,7 +790,7 @@ public async Task Batch_GetOrAdd_policy_FactoryTimeout_cancels_slow_generator() return []; } - var call = ((ICache)Sut).GetOrAddAsync(entries, Generator, policy, token).AsTask(); + var call = ((ICache)Sut).GetOrAddAsync(entries, Generator, policy, caller.Token).AsTask(); var finished = await Task.WhenAny(call, Task.Delay(TimeSpan.FromSeconds(10), token)); finished.Should().BeSameAs(call, "the batch generator must be bounded by CachePolicy.FactoryTimeout"); diff --git a/tests/UiPath.Caching.Tests/ResiliencePipelineFactoryTests.cs b/tests/UiPath.Caching.Tests/ResiliencePipelineFactoryTests.cs index 938fb899..c547a693 100644 --- a/tests/UiPath.Caching.Tests/ResiliencePipelineFactoryTests.cs +++ b/tests/UiPath.Caching.Tests/ResiliencePipelineFactoryTests.cs @@ -135,7 +135,7 @@ public async Task Pipeline_works_as_expected() var resiliencePipelineFactory = _fixture.Create(); var pipeline = resiliencePipelineFactory.Create("read", false); using var guard = CancellationTokenSource.CreateLinkedTokenSource(testContextAccessor.Current.CancellationToken); - guard.CancelAfter(TimeSpan.FromSeconds(5)); + guard.CancelAfter(TimeSpan.FromSeconds(30)); var act = async () => await pipeline.ExecuteAsync(timeoutFunc, guard.Token); await act.Should().ThrowAsync(); @@ -156,20 +156,24 @@ public async Task Pipeline_works_as_expected() } } actual.Should().BeFalse(); - actual = null; - await Task.Delay(250, testContextAccessor.Current.CancellationToken); - for (int i = 0; i < 4; i++) + + // The breaker reopens after DurationOfBreak, half-opens, then closes on the first + // successful probe. Poll for that instead of assuming it lands inside a fixed 250ms + 4x100ms + // budget: that leaves only 150ms of slack over a 500ms DurationOfBreak, and under parallel + // load it does not land, which is what made this test flaky. + var closed = false; + var sw = System.Diagnostics.Stopwatch.StartNew(); + while (sw.Elapsed < TimeSpan.FromSeconds(30)) { - await Task.Delay(100, testContextAccessor.Current.CancellationToken); - //we are in a circuit breaker state => no exception is thrown, returning default value - actual = await pipeline.ExecuteAsync(successFunc, testContextAccessor.Current.CancellationToken); - if(actual == true) + // While the breaker is open the fallback returns default(bool) rather than throwing. + closed = await pipeline.ExecuteAsync(successFunc, testContextAccessor.Current.CancellationToken); + if (closed) { - // circuit breaker is closed break; } + await Task.Delay(20, testContextAccessor.Current.CancellationToken); } - actual.Should().BeTrue(); + closed.Should().BeTrue("the breaker must close once DurationOfBreak has elapsed"); logMessages.Should().NotBeEmpty(); logMessages.Should().Contain(log => log.Contains("Execution timed out after"));