Skip to content

Instantly share code, notes, and snippets.

@ishanvohra2
Last active April 10, 2024 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishanvohra2/dbd984d3f52f3a2937ee48dad8d6613c to your computer and use it in GitHub Desktop.
Save ishanvohra2/dbd984d3f52f3a2937ee48dad8d6613c to your computer and use it in GitHub Desktop.
// Defining a cache of 5 MB size
val cacheSize = (5 * 1024 * 1024).toLong()
//Initializing instance of Cache class
val myCache = Cache(context.cacheDir, cacheSize)
//defining okhttpclient instance
val okHttpClient = OkHttpClient.Builder()
.cache(myCache)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment