question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I use 2 cache instances at the same time

See original GitHub issue

Searched documentation and issues

I referred Downloading Streams Medium post by Erdem Guven here Also checked similar issue https://github.com/google/ExoPlayer/issues/4062. Couldn’t find a clear solution.

Question

I have two cache, 1 for playback and 1 for downloads (Both have different Evictor rules, so different folders). I can’t find a way to use both cache at the same time. Am I doing something wrong here? If I use only one cache what will my evictor rules look like. How will I support both download and playback caches?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
erdemguvencommented, May 17, 2019

In ExoPlayer demo app, you can replace buildDataSourceFactory with this:

  public DataSource.Factory buildDataSourceFactory() {
    DefaultDataSourceFactory upstreamFactory =
        new DefaultDataSourceFactory(this, buildHttpDataSourceFactory());
    return buildReadOnlyCacheDataSource(
        new CacheDataSourceFactory(getPlaybackCache(), upstreamFactory), getDownloadCache());
  }

You can implement getPlaybackCache() similar to getDownloadCache().

0reactions
rishabh876commented, May 17, 2019

Thank you so much. I have tested this code. Working as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Multiple Cache Managers in Spring - Baeldung
Spring applies caching to methods so that our application doesn't execute the same method multiple times for the same input.
Read more >
Using multiple instances of MemoryCache - Stack Overflow
Considering an in memory cache will be process specific (not shared across multiple instances of a website or native business app or multiple...
Read more >
3 Ways to Configure Multiple Cache Managers in Spring Boot
A step by step guide to configure multiple cache managers in Spring Boot. Learn how to configure multiple cache manager in Spring using...
Read more >
Handling Multiple Instances Of Caching Providers Using ...
Here, we will use two types of caching providers with three instances - one in-memory caching provider and two Redis caching providers.
Read more >
Caching strategies - Amazon ElastiCache - AWS Documentation
If the data exists in the cache and is current, ElastiCache returns the data to your application. If the data doesn't exist in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found