Giter Club home page Giter Club logo

Comments (7)

prof18 avatar prof18 commented on May 24, 2024 1

Hi all, just to let you known that I'm working on it!

Commit: f985180

I think that a new release could be ready in a week or something.

from rss-parser.

prof18 avatar prof18 commented on May 24, 2024 1

Hi,
the cache expiration is decided by the date passed in the Builder and does not take into account the expiration date of the feed. But that can be a nice addition, I will think about that. Thanks for raising the topic.

from rss-parser.

prof18 avatar prof18 commented on May 24, 2024

The library doesn't support caching at parsing level. You have to implement it in your business logic.

from rss-parser.

jeffnyauke avatar jeffnyauke commented on May 24, 2024

The library doesn't support caching at parsing level. You have to implement it in your business logic.

Why. Is it something that can be implemented. For me, the OkHttp client I am passing to the Parser supports caching. It's not caching the requests though.

from rss-parser.

prof18 avatar prof18 commented on May 24, 2024

I'm going to explore this. Thank for the suggestion

from rss-parser.

jeffnyauke avatar jeffnyauke commented on May 24, 2024

Please explore ASAP.

The RSS I am trying to Cache is: http://news.google.com/news?q=covid-19&hl=en-US&sort=date&gl=us&num=20&output=rss

My OkHttpClient:

fun getOkHttpClient(context: Context): OkHttpClient {
    val cacheSize = (5 * 1024 * 1024).toLong()
    val myCache = Cache(context.cacheDir, cacheSize)

    return OkHttpClient.Builder()
        .cache(myCache)
        .addInterceptor { chain ->
            var request = chain.request()
            request = if (isNetworkAvailable(context)!!)
                request.newBuilder().header("Cache-Control", "public, max-age=" + 5).build()
            else
                request.newBuilder().header(
                    "Cache-Control",
                    "public, only-if-cached, max-stale=" + 60 * 60 * 24 * 7
                ).build()
            chain.proceed(request)
        }
        .build()
}

from rss-parser.

mainrs avatar mainrs commented on May 24, 2024

Does the caching mechanism take into account the update interval set in the feed? It seems like the cache is a simple datetime-based cache where items just expire after certain time.

from rss-parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.