Skip to content

Resource-doc cache keys should carry the dynamic entity definitions version #2956

Open

Description

@hongwei1

With #2955, a dynamic entity definition change bumps the dynamic_entity cache namespace and then rd_dynamic / rd_all once its transaction has committed. Another instance re-reads the dynamic_entity version at most once a second (Constant.recentCacheNamespaceVersion), but reads the rd_* versions from Redis on every request. So for up to a second after a change, that instance can build /resource-docs or a swagger document (which include each entity's endpoint docs, DynamicEntityHelper.v700Doc) from its previous definitions map and store it under the new rd_* version, where it is served for dynamicResourceDocsObp.cache.ttl.seconds (default 3600).

Proposal: append the dynamic entity definitions version to the resource-doc cache key, as APIUtil.createResourceDocCacheKey already appends -glossary:<version> for the Glossary, e.g. -dynamicEntity:<version>, read through the same local copy the definitions map uses. A document then always lives under the definitions version it was built from, there is no window, and the rd_* bump for dynamic entities is no longer needed. The key is shared by every resource-doc and swagger document built in Http4sResourceDocs (static content included), so either static documents are also rebuilt after a definition change, or the segment is added only for content that includes dynamic docs; Http4sDomainApi builds its own key and would need the same treatment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions