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

Introduce GraphQL Server-side Caching #1735

Merged

Conversation

DimuthuMadushan
Copy link
Contributor

@DimuthuMadushan DimuthuMadushan commented Feb 1, 2024

Purpose

Fixes: #3621
Fixes: #6017

Related release: https://github.com/ballerina-platform/ballerina-release/issues/2623

Examples

import ballerina/graphql;

@graphql:ServiceConfig {
    cacheConfig: {
        enabled: true,
        maxAge: 50
    }
}
service /graphql on new graphql:Listener(9090) {
    private string name = "Ballerina GraphQL";
    private string 'type = "code first";

    resource function get name() returns string {
        return self.name;
    }

    resource function get 'type() returns string {
        return self.'type;
    }

    remote function updateName(graphql:Context context, string name) returns string|error {
        check context.evictCache("name");
        self.name = name
        return self.name;
    }
}

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility
  • No commons package changes (if there are any, please update the GraphQL version in GraphQL tools and Ballerina dev tools)
  • No compiler package changes (if there are any, please update the GraphQL version in Ballerina dev tools)

DimuthuMadushan and others added 29 commits January 2, 2024 12:27
…onal

Add test cases to validate caching in operational level
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: 63 lines in your changes are missing coverage. Please review.

Comparison is base (c2fd94e) 86.26% compared to head (188b858) 86.22%.
Report is 1 commits behind head on master.

Files Patch % Lines
...va/io/ballerina/stdlib/graphql/compiler/Utils.java 46.15% 9 Missing and 12 partials ⚠️
...l/compiler/service/validator/ServiceValidator.java 81.94% 1 Missing and 12 partials ⚠️
...vice/validator/ResourceConfigAnnotationFinder.java 18.18% 8 Missing and 1 partial ⚠️
...a/stdlib/graphql/compiler/ServiceAnalysisTask.java 55.55% 3 Missing and 1 partial ⚠️
ballerina/engine.bal 94.11% 3 Missing ⚠️
...er/ModuleLevelVariableDeclarationAnalysisTask.java 0.00% 3 Missing ⚠️
...allerina/stdlib/graphql/runtime/engine/Engine.java 80.00% 2 Missing and 1 partial ⚠️
ballerina/context.bal 80.00% 2 Missing ⚠️
...mpiler/schema/generator/GraphqlSourceModifier.java 95.74% 2 Missing ⚠️
ballerina/annotation_processor.bal 92.85% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1735      +/-   ##
============================================
- Coverage     86.26%   86.22%   -0.04%     
- Complexity      771      811      +40     
============================================
  Files           130      131       +1     
  Lines          9153     9497     +344     
  Branches       3569     3676     +107     
============================================
+ Hits           7896     8189     +293     
- Misses          953      979      +26     
- Partials        304      329      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Quality Gate Passed Quality Gate passed

Issues
3 New issues

Measures
0 Security Hotspots
No data about Coverage
0.7% Duplication on New Code

See analysis details on SonarCloud

@DimuthuMadushan DimuthuMadushan merged commit 33c9bfd into ballerina-platform:master Feb 12, 2024
7 of 8 checks passed
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.

Add Compilation Error for Invalid Modification of 'ServiceConfig' Fields Introduce GraphQL Caching
4 participants