You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The optinal field `enabled` accepts a `boolean` that denotes whether the server-side operation cache is enabled or not. By default, it has been set to `true`.
1809
1810
1810
1811
##### 7.1.9.2 The `maxAge` Field
1811
-
The optional field `maxAge` accepts a valid `decimal` value which considers as the TTL(Time To Live) in seconds. The default maxAge is `60` seconds.
1812
+
1813
+
The optional field `maxAge` accepts a valid `decimal` value which is considerd as the TTL(Time To Live) in seconds. The default maxAge is `60` seconds.
1812
1814
1813
1815
##### 7.1.9.3 The `maxSize` Field
1816
+
1814
1817
The optional field `maxSize` accepts an int that denotes the maximum number of cache entries in the cache table. By default, it has been set to `120`.
1815
1818
1816
1819
### 7.2 Resource Configuration
@@ -1873,20 +1876,20 @@ service on new graphql:Listener(9090) {
1873
1876
}
1874
1877
```
1875
1878
1876
-
#### 7.2.3 Field Cache Configuration
1879
+
#### 7.2.3 Field-level Cache Configuration
1877
1880
1878
-
The `cacheConfig` field is used to provide the field cache configs. The fields are as same as the operation cache configs. The field configurations override the operation configurations.
1881
+
The `cacheConfig` field is used to provide the field-level cache configs. The fields are as same as the operation cache configs. The field configurations override the operation configurations.
1879
1882
1880
-
###### Example: Field Cache Configs
1883
+
###### Example: Field-level Cache Configs
1881
1884
1882
1885
```ballerina
1883
1886
service on new graphql:Listener(9090) {
1884
1887
1885
1888
@graphql:ResourceConfig {
1886
1889
cacheConfig: {
1887
1890
enabled: true,
1888
-
maxAge: 60,
1889
-
maxSize: 120
1891
+
maxAge: 90,
1892
+
maxSize: 80
1890
1893
}
1891
1894
}
1892
1895
resource function get name(int id) returns string {
@@ -3595,7 +3598,7 @@ distinct service class Author {
3595
3598
}
3596
3599
```
3597
3600
3598
-
###### Example: Overriding the Defalut`prefetch` Method Name
3601
+
###### Example: Overriding the Default`prefetch` Method Name
3599
3602
3600
3603
```ballerina
3601
3604
distinct service class Author {
@@ -3612,7 +3615,7 @@ distinct service class Author {
3612
3615
}
3613
3616
```
3614
3617
3615
-
Bringing everything together, the subsequent examples demonstrates how to engage a DataLoader with a GraphQL service.
3618
+
Bringing everything together, the subsequent examples demonstrate how to engage a DataLoader with a GraphQL service.
3616
3619
3617
3620
###### Example: Utilizing a DataLoader in a GraphQL Service
3618
3621
@@ -3753,15 +3756,15 @@ This section describes the caching mechanisms in the Ballerina GraphQL module.
3753
3756
3754
3757
#### 10.7.1 Server-side Caching
3755
3758
3756
-
The Ballerina GraphQL module offers built-in server-side caching for GraphQL `query` operations. The caching operates as in-memory caching, implemented using the Ballerina cache module. The GraphQL module generates cache keys based on the arguments and the path. In server-side caching, the `errors` and `null` values are skipped when caching. There are two different ways called `operation caching` and `field caching` to enable server-side caching.
3759
+
The Ballerina GraphQL module offers built-in server-side caching for GraphQL `query` operations. The caching operates as in-memory caching, implemented using the Ballerina cache module. The GraphQL module generates cache keys based on the arguments and the path. In server-side caching, the `errors` and `null` values are skipped when caching. There are two different ways called `operation-level caching` and `field-level caching` to enable server-side caching.
3757
3760
3758
-
##### 10.7.1.1 Operation Caching
3761
+
##### 10.7.1.1 Operation-level Caching
3759
3762
3760
-
Operation caching can be used to cache the entire operation, and this can be enabled by providing the [operation cache configurations](#719-operation-cache-configurations). Once enabled, the GraphQL server initiates caching for all subfields of `query` operations. The fields requested through query operations will be cached based on the specified cache configurations
3763
+
Operation-level caching can be used to cache the entire operation, and this can be enabled by providing the [operation cache configurations](#719-operation-level-cache-configurations). Once enabled, the GraphQL server initiates caching for all subfields of `query` operations. The fields requested through query operations will be cached based on the specified cache configurations
3761
3764
3762
-
##### 10.7.1.2 Field Caching
3765
+
##### 10.7.1.2 Field-level Caching
3763
3766
3764
-
The GraphQL field caching can be enabled only for a specific field. This can be done by providing the [field cache configurations](#723-field-cache-configuration). Once the field caching is enabled for a field, it will be applied to the sub-fields of that field.
3767
+
The GraphQL field-level caching can be enabled only for a specific field. This can be done by providing the [field cache configurations](#723-field-level-cache-configuration). Once the field-level caching is enabled for a field, it will be applied to the sub-fields of that field.
3765
3768
3766
3769
#### 10.7.1.3 Cache Eviction
3767
3770
@@ -3783,7 +3786,7 @@ The `invalidateAll` method can be used to clear the entire cache table. This met
3783
3786
public isolated function invalidateAll() returns error? {}
3784
3787
```
3785
3788
3786
-
###### Example: Operation Cache Enabling and Eviction
3789
+
###### Example: Operation-level Cache Enabling and Eviction
3787
3790
3788
3791
```ballerina
3789
3792
import ballerina/graphql;
@@ -3816,7 +3819,7 @@ service /graphql on new graphql:Listener(9090) {
3816
3819
3817
3820
In this example, caching is enabled at the operation level. Therefore, the field `name` and `type` will be cached. When updating the name with a mutation, the cached values become invalid. Hence, the `invalidate` function can be used to evict the existing cache values.
3818
3821
3819
-
###### Example: Field Cache Enabling and Eviction
3822
+
###### Example: Field-level Cache Enabling and Eviction
3820
3823
3821
3824
```ballerina
3822
3825
import ballerina/graphql;
@@ -3883,4 +3886,4 @@ public isolated distinct service class Person {
3883
3886
}
3884
3887
```
3885
3888
3886
-
In this example, GraphQL field caching is enabled for the `age` field via the resource configurations. When the age is changed using the `updateAge` operation, the `invalidate` method is used to remove the existing cache entries related to the age field.
3889
+
In this example, GraphQL field-level caching is enabled for the `age` field via the resource configurations. When the age is changed using the `updateAge` operation, the `invalidate` method is used to remove the existing cache entries related to the age field.
0 commit comments