Redis and Caching Configuration

OSA Proxy implementation

This page describes the current OSA Proxy implementation. The archived Java/Spring implementation is available in Archived Java/Spring implementation.

OSA Proxy supports Redis caching for Judge verdicts to speed up repeated requests and reduce CodeScoring load. The cache is disabled by default.

cache:
  judge:
    enabled: true
    ttl: 24h
    refresh-after: 30m
    proactive-refresh-enabled: false
    proactive-refresh-interval: 2h
    proactive-refresh-workers: 10
    key-prefix: "cs:judge:"
  redis:
    address: redis:6379
    username: ""
    password: ""
    db: 0

Parameters

ParameterPurpose
cache.judge.enabledEnables Redis cache for Judge check results.
cache.judge.ttlCache entry lifetime. Default is 24h.
cache.judge.refresh-afterEntry age after which it can be refreshed in the background. Default is 30m.
cache.judge.proactive-refresh-enabledEnables periodic background refresh for stale entries. Default is false.
cache.judge.proactive-refresh-intervalBackground refresh interval. Default is 2h.
cache.judge.proactive-refresh-workersNumber of background refresh workers. Default is 10.
cache.judge.key-prefixRedis key prefix.
cache.redis.addressRedis address in host:port format.
cache.redis.usernameRedis ACL username.
cache.redis.passwordRedis password.
cache.redis.dbRedis database number.

Redis Sentinel

Enable Sentinel for Redis HA. A regular cache.redis.address is not required in this mode. Redis master and Sentinel credentials are configured independently:

cache:
  judge:
    enabled: true
    ttl: 24h
    refresh-after: 30m
    key-prefix: "cs:judge:"
  redis:
    username: redis-user
    password: redis-password
    db: 0
    sentinel:
      enabled: true
      master-name: mymaster
      addresses:
        - sentinel-1:26379
        - sentinel-2:26379
        - sentinel-3:26379
      username: sentinel-user
      password: sentinel-password

If Redis is temporarily unavailable, OSA Proxy continues to use the available local caching mechanisms.

TTL and background refresh

Background refresh does not extend an entry TTL by itself. TTL is extended when data is read from the cache by real requests, so rarely used entries are eventually removed from Redis.

Cache Management

The operational API is available through Swagger UI:

https://osa-proxy.example.com/api/swagger/

Main operations:

  • DELETE /api/cache/purls — delete specific PURLs from the verdict cache;
  • DELETE /api/cache/packages/{packageType} — delete entries by package type, package name, or repository context.
Was this page helpful?