From d3d4c41c45fafa9a876c80f9592cfc9d08ad8729 Mon Sep 17 00:00:00 2001 From: Thomas Poignant Date: Wed, 15 May 2024 11:39:54 +0200 Subject: [PATCH] feat: Specify caching for OFREP in server providers Signed-off-by: Thomas Poignant --- service/openapi.yaml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/service/openapi.yaml b/service/openapi.yaml index cbda1b2..6b37dfa 100644 --- a/service/openapi.yaml +++ b/service/openapi.yaml @@ -48,7 +48,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/evaluationSuccess' + $ref: '#/components/schemas/serverEvaluationSuccess' '400': description: Bad evaluation request content: @@ -221,6 +221,13 @@ components: properties: context: $ref: '#/components/schemas/context' + serverEvaluationSuccess: + allOf: + - $ref: "#/components/schemas/evaluationSuccess" + - properties: + cacheable: + type: boolean + description: Let the provider know that this flag evaluation can be cached evaluationSuccess: description: Flag evaluation success response. allOf: @@ -354,6 +361,8 @@ components: $ref: '#/components/schemas/featureCacheInvalidation' flagEvaluation: $ref: '#/components/schemas/flagEvaluation' + caching: + $ref: '#/components/schemas/featureCaching' flagEvaluation: type: object description: Configurations specific for flag evaluations in OFREP provider implementation @@ -390,4 +399,16 @@ components: examples: - 60000 required: - - name \ No newline at end of file + - name + featureCaching: + type: object + description: Configuration of the caching mechanism in the provider (used by server providers) + properties: + enabled: + type: boolean + description: set to true if you want the provider to cache the evaluation results + ttl: + type: number + examples: + - 1000 + description: number (in millisecond) to wait before invalidating the cache. If we have cacheInvalidation enabled, the cache can also be evicted if a configuration change happen. \ No newline at end of file