React Native Http Cache

screenshot of React Native Http Cache
react-native

Native module to control react native http cache

Overview:

The React Native http cache control package enhances the caching functionality for both fetch/XMLHttpRequest and ImageView in iOS and Android platforms. By providing features for clearing cache and retrieving cache size, this library optimizes the handling of cached data. The installation process for iOS involves linking the library in XCode project, while for Android it requires linking to the Gradle project.

Features:

  • clear(): Clears cache for all types.
  • getSize(): Retrieves the cache size for all types.
  • clearHttpCache(): Clears cache for fetch/ajax requests only.
  • getHttpCacheSize(): Retrieves the cache size for fetch/ajax requests.
  • clearImageCache(): Clears cache for ImageView only.
  • getImageCacheSize(): Retrieves the cache size for ImageView.

iOS:

  • Link the react-native-http-cache library from your node_modules/react-native-http-cache/ios folder.
  • Add the library to the "Build Phases" of your XCode project.

Android:

  • Add the specified lines to the android/settings.gradle file.
  • Add the specified lines to the android/app/build.gradle file in the dependencies section.
  • Add the specified lines to the MainApplication.java file.
  • If java code minification is required, add the provided lines to 'proguard-rules.pro'.

Summary:

The React Native http cache control package offers a convenient solution for managing and optimizing cache operations in React Native applications. With features like clearing cache, retrieving cache size, and platform-specific installation guides, this library simplifies the handling of cached data in both iOS and Android environments. The collaboration between authors Deng Yun and Bingru from React-Native-CN adds credibility to this useful tool for developers utilizing React Native.

react-native
React Native

React Native is a framework for building mobile applications using React and JavaScript. It enables developers to write once and deploy to multiple platforms, including iOS, Android, and the web, while providing a native app-like experience to users.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.