Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event cache status #2520

Closed
pi0 opened this issue Jun 13, 2024 · 1 comment
Closed

Event cache status #2520

pi0 opened this issue Jun 13, 2024 · 1 comment
Labels
discussion enhancement New feature or request

Comments

@pi0
Copy link
Member

pi0 commented Jun 13, 2024

(context: discussion with @atinux on discord and initial draft of #2519 for the idea of having a way to know if a request event is within the cache and transform it to the client state)

Currently, there is no straight-forward way to know if an event object is within a cachedEventHandler context. It can be determined by checking filtered headers for example like User-Agent header.

One simple way (as initially proposed in #2519) is to add a new event.context.isCached flag to determine this but this looses some context:

  • Are we responding first time to a cache or refreshing the cache
  • Is the cache skipped
  • What headers would be finally allowed to the client (some utils might need to make sure they work as expected)

Because of this, i am thinking to introduce a new event.context.cache: {} namespace to preserve the state:

Keys:

  • (if context.cache key exists, it is synonym of context.isCached)
  • cache.options: Cache options (should not be modified)

In next steps, we can provide additional info but requires some refactors on implementation:

  • cache.isBypassed
  • cache.key: Generated internal cache key
  • [...]
@pi0 pi0 added enhancement New feature or request discussion labels Jun 13, 2024
@pi0 pi0 pinned this issue Jun 13, 2024
@pi0 pi0 unpinned this issue Jun 13, 2024
@pi0
Copy link
Member Author

pi0 commented Jun 13, 2024

Landed with #2519. Closing issue for now because most of next steps need complete refactor on cache layer (upcoming).

@pi0 pi0 closed this as completed Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant