{"id":15728600,"url":"https://github.com/reactnativecn/react-native-http-cache","last_synced_at":"2025-04-04T21:08:00.612Z","repository":{"id":57105117,"uuid":"48740632","full_name":"reactnativecn/react-native-http-cache","owner":"reactnativecn","description":"Native module to control react native http cache","archived":false,"fork":false,"pushed_at":"2024-03-10T13:59:07.000Z","size":21,"stargazers_count":225,"open_issues_count":30,"forks_count":109,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-28T20:06:34.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reactnativecn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-12-29T09:51:37.000Z","updated_at":"2024-11-02T04:33:33.000Z","dependencies_parsed_at":"2024-06-18T18:36:04.002Z","dependency_job_id":"af1da055-0397-4831-920a-246eed76681e","html_url":"https://github.com/reactnativecn/react-native-http-cache","commit_stats":{"total_commits":14,"total_committers":6,"mean_commits":"2.3333333333333335","dds":0.5714285714285714,"last_synced_commit":"ab4571a7584ba6b5796e83752e25b2f1a6c9cf28"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-http-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-http-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-http-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-http-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactnativecn","download_url":"https://codeload.github.com/reactnativecn/react-native-http-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249525,"owners_count":20908212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T23:04:31.168Z","updated_at":"2025-04-04T21:08:00.594Z","avatar_url":"https://github.com/reactnativecn.png","language":"Java","readme":"React Native http cache control for both fetch/XMLHttpRequest and ImageView\n\n- [x] iOS\n- [x] Android\n\n## Installation\n\n```sh\n$ npm install react-native-http-cache --save\n```\n\n## iOS: Linking in your XCode project\n\n- Link `react-native-http-cache` library from your `node_modules/react-native-http-cache/ios` folder like its\n  [described here](http://facebook.github.io/react-native/docs/linking-libraries-ios.html).\n  Don't forget to add it to \"Build Phases\" of project.\n\n## Android: Linking to your gradle Project\n\n- Add following lines into `android/settings.gradle`\n\n```\ninclude ':RCTHttpCache'\nproject(':RCTHttpCache').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-http-cache/android')\n```\n\n- Add following lines into your `android/app/build.gradle` in section `dependencies`\n\n```\n...\ndependencies {\n   ...\n   compile project(':RCTHttpCache')    // Add this line only.\n}\n```\n\n- Add following lines into `MainApplication.java`\n\n```java\n...\nimport cn.reactnative.httpcache.HttpCachePackage;\n      // Add this line before public class MainApplication\n\npublic class MainApplication extends Application implements ReactApplication {\n\n  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {\n    @Override\n    protected boolean getUseDeveloperSupport() {\n      return BuildConfig.DEBUG;\n    }\n\n    @Override\n    protected List\u003cReactPackage\u003e getPackages() {\n      return Arrays.\u003cReactPackage\u003easList(\n          new HttpCachePackage(), // Add this line\n          new MainReactPackage()\n      );\n    }\n  };\n\n  @Override\n  public ReactNativeHost getReactNativeHost() {\n      return mReactNativeHost;\n  }\n}\n```\n\n- Add these lines to 'proguard-rules.pro' if you need to minify your java code:\n\n```\n-keep class com.facebook.cache.disk.DiskStorageCache {\n   private boolean maybeUpdateFileCacheSize();\n}\n```\n\n## JavaScript: import all and invoke!\n\n```js\nimport * as CacheManager from 'react-native-http-cache';\n\n// invoke API directly when in need\nCacheManager.clear();\n\n```\n\n## API Documentation\n\n#### clear()\n\nClear cache for all type.\n\nReturn a promise which indicate the clear state.\n\n#### getSize()\n\nGet cache size for all type.\n\nReturn a promise that contain the cache size(in bytes).\n\n#### clearHttpCache()\n\nClear cache for fetch/ajax only.\n\nReturn a promise which indicate the clear state.\n\n#### getHttpCacheSize()\n\nGet cache size for fetch/ajax only.\n\nReturn a promise that contain the cache size(in bytes).\n\n#### clearImageCache()\n\nClear cache for ImageView only.\n\nReturn a promise which indicate the clear state.\n\n#### getImageCacheSize()\n\nGet cache size for ImageView only.\n\nReturn a promise that contain the cache size(in bytes).\n\n## Authors\n\n- [Deng Yun](https://github.com/tdzl2003) from [React-Native-CN](https://github.com/reactnativecn)\n- [Lv Bingru](https://github.com/lvbingru) from [React-Native-CN](https://github.com/reactnativecn)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactnativecn%2Freact-native-http-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactnativecn%2Freact-native-http-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactnativecn%2Freact-native-http-cache/lists"}