Skip to content

Commit f54b906

Browse files
authored
Add info on default_cache_expiration (#896)
Include `default_cache_expiration` in the following instructions: * Read Example * Cache Example Relates-To: OLPEDGE-2004 Signed-off-by: Halyna Dumych <ext-halyna.dumych@here.com>
1 parent 03da4b0 commit f54b906

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

docs/dataservice-cache-example.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,21 @@ You need to create the `OlpClientSettings` object to get catalog and partition m
111111
112112
3. [Authenticate](#authenticate-to-here-olp-using-client-credentials) to the HERE platform.
113113

114-
4. Set up the `OlpClientSettings` object with the path to the needed cache settings properties (the limit of runtime memory, disk space, maximum file size, memory data cache size, options, and paths).
115-
For instructions on how to get the path to the cache settings, see the [Build and Run on Linux](#build) section.
116-
> **Note:** Perform the first call with the valid mutable cache path, and the second call – with the protected cache path.
114+
4. (Optional) For data that is stored in the cache, to add expiration limit, set the `default_cache_expiration` to the needed expiration time.
115+
116+
By default, expiration is disabled.
117+
118+
> Note: You can only disable expiration for the mutable and in-memory cache. This setting does not affect the protected cache as no entries are added to the protected cache in the read-only mode.
119+
120+
```cpp
121+
std::chrono::seconds default_cache_expiration = std::chrono::seconds(200);
122+
```
123+
124+
5. Set up the `OlpClientSettings` object with the path to the needed cache settings properties (the limit of runtime memory, disk space, maximum file size, memory data cache size, options, and paths).
125+
126+
For instructions on how to get the path to the cache settings, see the [Build and Run on Linux](#build) section.
127+
128+
> **Note:** Perform the first call with the valid mutable cache path, and the second call – with the protected cache path.
117129
118130
```cpp
119131
client_settings.cache =

docs/dataservice-read-catalog-example.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,17 @@ You need to create the `OlpClientSettings` object to get catalog and partition m
215215
216216
3. [Authenticate](#authenticate-to-here-olp-using-client-credentials) to the HERE platform.
217217

218-
4. Set up the `OlpClientSettings` object.
218+
4. (Optional) For data that is stored in the cache, to add expiration limit, set the `default_cache_expiration` to the needed expiration time.
219+
220+
By default, expiration is disabled.
221+
222+
> Note: You can only disable expiration for the mutable and in-memory cache. This setting does not affect the protected cache as no entries are added to the protected cache in the read-only mode.
223+
224+
```cpp
225+
std::chrono::seconds default_cache_expiration = std::chrono::seconds(200);
226+
```
227+
228+
5. Set up the `OlpClientSettings` object.
219229

220230
```cpp
221231
olp::client::OlpClientSettings client_settings;
@@ -224,6 +234,7 @@ You need to create the `OlpClientSettings` object to get catalog and partition m
224234
client_settings.network_request_handler = std::move(http_client);
225235
client_settings.cache =
226236
olp::client::OlpClientSettingsFactory::CreateDefaultCache({});
237+
client_settings.default_cache_expiration = std::chrono::seconds(200);
227238
```
228239
229240
The `OlpClientSettings` class pulls together all the settings for customization of the client library behavior:

0 commit comments

Comments
 (0)