commercetools / commercetools/rmf-codegen

Best Practice 3 - Cache: Local and remote strategy.

Open
#196 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
16
Forks
7
Avg merge
1d 3h
Merged PRs (30d)
3

Description

Commercetools resources are versioned, so it is possible to cache resources, since in case the cache is outdated we get a version conflict from the platform and all we have to do is invalidate the outdated cache entry.

We can use both cache strategies, either local, or remote (redis or other cach providers). but at the same time we dont want to bind ourselves to a specific provider, this is why we can create a cache interface that we use in a middleware. and which abstract the cache (local and remote ) away.

maybe use `javax.persistence.Cache`, or create an interface similar to

```java
public interface CtpCache {
Future upsert(String key, Object object);
Future get(String key);
void invalidate(String key);
}

public class CacheMiddleware {
public CacheMiddleware(CtpCache cache){
.....
}
}
```

linked to https://github.com/commercetools/rmf-codegen/issues/192

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.