Coder Social home page Coder Social logo

HTTP Cache about apikit HOT 4 CLOSED

ishkawa avatar ishkawa commented on May 28, 2024
HTTP Cache

from apikit.

Comments (4)

ishkawa avatar ishkawa commented on May 28, 2024

Hi @jyounus,

Yes. Session.shared uses URLSessionConfiguration.default, and its urlCache property references the same instance that URLCache.shared returns. You can also customize cache storage by setting the property.

var configuration = URLSessionConfiguration.default
configuration.url = /* Set your URLCache */

let adapter = URLSessionAdapter(configuration: configuration)
let session = Session(adapter: adapter)

from apikit.

jyounus avatar jyounus commented on May 28, 2024

Ah okay. If I did what you just posted, is there any way for me to change the default Session.shared instance that's returned with my custom configured one?

from apikit.

ishkawa avatar ishkawa commented on May 28, 2024

Session.shared is provided by private static method, so we can't replace that. I recommend configuring URLCache.shared to customize cache behavior of Session.shared.

from apikit.

jyounus avatar jyounus commented on May 28, 2024

Fair enough. Thanks! :)

from apikit.

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.