Skip to content

Improve multi-tenancy in RepositoryCache  #1231

@alexander-yevsyukov

Description

@alexander-yevsyukov

Now RepositoryCache (which belongs to the server.entity package) implements the caching basing on IdInTenant class (which belongs to server.tenant package). IdInTenant is a pair of ID of an entity and a TenantId to which the ID belongs.

Issues with the current implementations:

  • We duplicate TenantId for all the IDs per tenant in the cache. It would be better to have cache slices.
  • The cache treats multi-tenancy differently than storages. This is a bit confusing

Consider implementing generic cache with multi-tenancy support which can cache any type of things. Then, RepositoryCache can extend this generic cache, specifying generic parameter of the thing to store in cache to be Entity<I, ?>. This way we would not link the tenant package with the entity package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions