Skip to content

Polish: AOT compatibility, zero-copy TryGetAsync, purge-by-prefix helper #45

Description

@matthewdevenny

A few small, independent hardening items. Each is a good first issue and can be split out if someone wants to pick one up.

1. AOT / trimming compatibility

Mark the core package IsAotCompatible and enable the trim/AOT analyzers. The source-gen JSON context already helps; the generic HybridCache serializer path (NatsHybridCacheSerializer) is the part to validate.

2. Zero-copy TryGetAsync

NatsCache.TryGetAsync(string, IBufferWriter<byte>, …) currently fetches a byte[] and copies it into the destination (src/NatsDistributedCache/NatsCache.cs), partially defeating the point of IBufferDistributedCache. Investigate deserializing/writing directly into the supplied IBufferWriter<byte>.

3. Maintenance helper: clear-by-prefix / purge

For multi-tenant users of CacheKeyPrefix, provide a helper to purge entries by prefix. INatsKVStore.GetKeysAsync + PurgeAsync make this feasible.

Acceptance criteria

  • Each item delivered (or split into its own issue) with a test where applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions