Skip to content

APPT-2107: add sliding cache implementation to get all sites#1533

Open
pata9 wants to merge 5 commits intomainfrom
appt-2107/getsites_slidingCache
Open

APPT-2107: add sliding cache implementation to get all sites#1533
pata9 wants to merge 5 commits intomainfrom
appt-2107/getsites_slidingCache

Conversation

@pata9
Copy link
Contributor

@pata9 pata9 commented Mar 19, 2026

Description

Due to performance concerns we're introducing Sliding Cache for get all sites. I made this change in a way that we can move back to the basic caching if we need to in the future

Fixes # (issue)

Checklist:

  • My work is behind a feature toggle (if appropriate)
  • If my work is behind a feature toggle, I've added a full suite of tests for both the ON and OFF state
  • The ticket number is in the Pull Request title, with format "APPT-XXX: My Title Here"
  • I have ran npm tsc / lint (in the future these will be ran automatically)
  • My code generates no new .NET warnings (in the future these will be treated as errors)
  • If I've added a new Function, it is disabled in all but one of the terraform groups (e.g. http_functions)
  • If I've added a new Function, it has both unit and integration tests. Any request body validators have unit tests also
  • If I've made UI changes, I've added appropriate Playwright and Jest tests
  • If I've added/updated an end-point, I've added the appropriate annotations and tested the Swagger documentation reflects the change

@pata9 pata9 marked this pull request as ready for review March 19, 2026 16:38
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE


public async Task<T> GetCacheValue<T>(string cacheKey, CacheOptions<T> options)
{
if (memoryCache.TryGetValue<CacheObject<T>>(cacheKey, out var value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not taking a SemaphoreSlim lock on this method, is that intentional?

internal async Task UpdateSiteInCacheAsync(string siteId)
{
if (options.Value.DisableSiteCache)
if (options.Value.SlidingCacheEnabled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we name this something else, as it only represents enablement for GetAllSites rather than generally

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants