{"id":20620917,"url":"https://github.com/irons163/irhttpcache","last_synced_at":"2025-03-06T23:13:15.019Z","repository":{"id":56915167,"uuid":"352890313","full_name":"irons163/IRHTTPCache","owner":"irons163","description":"IRHTTPCache is a powerful media cache framework. It can cache HTTP request, and very suitable for media resources.","archived":false,"fork":false,"pushed_at":"2021-05-05T09:53:38.000Z","size":58105,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T06:35:01.941Z","etag":null,"topics":["cache","http-cache","video-cache"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/irons163.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-30T06:12:26.000Z","updated_at":"2022-11-24T13:42:10.000Z","dependencies_parsed_at":"2022-08-20T20:50:35.423Z","dependency_job_id":null,"html_url":"https://github.com/irons163/IRHTTPCache","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRHTTPCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRHTTPCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRHTTPCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRHTTPCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irons163","download_url":"https://codeload.github.com/irons163/IRHTTPCache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242298974,"owners_count":20104922,"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":["cache","http-cache","video-cache"],"created_at":"2024-11-16T12:16:06.615Z","updated_at":"2025-03-06T23:13:15.002Z","avatar_url":"https://github.com/irons163.png","language":"Objective-C","readme":"![Build Status](https://img.shields.io/badge/build-%20passing%20-brightgreen.svg)\n![Platform](https://img.shields.io/badge/Platform-%20iOS%20-blue.svg)\n\n# IRHTTPCache \n\n- IRHTTPCache is a copy project from [KTVHTTPCache](https://github.com/ChangbaDevs/KTVHTTPCache).\n\n- IRHTTPCache is a powerful media cache framework. It can cache HTTP request, and very suitable for media resources.\n\n- A usage case is using IRHTTPCache combine with the video player([IRPlayer](https://github.com/irons163/IRPlayer))  for cache.\n\n## Features\n\n- Support Swift.\n- Thread safety.\n- Logging system, Support for console and file output.\n- Accurate view caching information.\n- Provide different levels of interface.\n- Adjust the download configuration.\n- Including demo\n    - AVPlayer\n    - ([IRPlayer](https://github.com/irons163/IRPlayer))\n\n## Install\n### Git\n- Git clone this project.\n- Copy this project into your own project.\n- Add the .xcodeproj into you  project and link it as an embed framework.\n- Also, link IRCocoaHTTPServer as an embed framework.\n#### Options\n- You can remove the `demo` and `ScreenShots` folder.\n\n### Cocoapods\n- Add `pod 'IRHTTPCache'`  in the `Podfile`\n- `pod install`\n\n## Usage\n\n### Swift\n\n```swift\nlet _: () = { () -\u003e () in\n    self.setupHTTPCache()\n}()\n        \n...\n\nfunc setupHTTPCache() {\n    IRHTTPCache.logSetConsoleLogEnable(true)\n    do {\n        try IRHTTPCache.proxyStart()\n        NSLog(\"Proxy Start Success\");\n    } catch {\n        NSLog(\"Proxy Start Failure\");\n    }\n\n    IRHTTPCache.encodeSetURLConverter { (URL) -\u003e URL? in\n        NSLog(\"URL Filter reviced URL\")\n        return URL\n    }\n\n    IRHTTPCache.downloadSetUnacceptableContentTypeDisposer { (URL, contentType) -\u003e Bool in\n        NSLog(\"Unsupport Content-Type Filter reviced URL\")\n        return false\n    }\n}\n```\n\n- Generated proxy URL.\n\n```swift\nIRHTTPCache.proxyURL(withOriginalURL: originalURL)\n```\n\n### ObjC\n\n- Start proxy.\n\n```objc\n[IRHTTPCache proxyStart:\u0026error];\n```\n\n- Generated proxy URL.\n\n```objc\nNSURL *proxyURL = [IRHTTPCache proxyURLWithOriginalURL:originalURL];\nAVPlayer *player = [AVPlayer playerWithURL:proxyURL];\n```\n\n- Get the complete cache file URL if existed.\n\n```objc\nNSURL *completeCacheFileURL= [IRHTTPCache cacheCompleteFileURLWithURL:originalURL];\n```\n\n- Set the URL filter processing mapping relationship.\n\n```objc\n[IRHTTPCache encodeSetURLConverter:^NSURL *(NSURL *URL) {\n    return URL;\n}];\n```\n\n- Download Configuration\n\n```objc\n// Timeout interval.\n[IRHTTPCache downloadSetTimeoutInterval:30];\n\n// Accept Content-Type.\n[IRHTTPCache downloadSetAcceptableContentTypes:contentTypes];\n\n// Set unsupport Content-Type filter.\n[IRHTTPCache downloadSetUnacceptableContentTypeDisposer:^BOOL(NSURL *URL, NSString *contentType) {\n    return NO;\n}];\n\n// Additional headers.\n[IRHTTPCache downloadSetAdditionalHeaders:headers];\n\n// Whitelist headers.\n[IRHTTPCache downloadSetWhitelistHeaderKeys:headers];\n```\n\n- Log.\n\n```objc\n// Console.\n[IRHTTPCache logSetConsoleLogEnable:YES];\n\n// File.\n[IRHTTPCache logSetRecordLogEnable:YES];\nNSString *logFilePath = [IRHTTPCache logRecordLogFilePath];\n```\n\n## Screenshots\n| Demo Main Page | Demo1 |\n|:---:|:---:|\n|![Demo1](./ScreenShots/demo1.png)|![Demo2](./ScreenShots/demo2.png)| \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firons163%2Firhttpcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firons163%2Firhttpcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firons163%2Firhttpcache/lists"}