{"id":19571326,"url":"https://github.com/orucanil/anwcachemanager","last_synced_at":"2025-10-13T05:32:10.064Z","repository":{"id":197658159,"uuid":"70031893","full_name":"orucanil/ANWCacheManager","owner":"orucanil","description":"Memory friendly caching in directory and simple use user defaults methods. Every cached object has a life cycle and it will be deleted when it expires. It uses the memory and file directory in a complex and effective way.","archived":false,"fork":false,"pushed_at":"2017-07-25T05:44:08.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T10:45:58.939Z","etag":null,"topics":["cache","cachemanager","directory","ios","memcached","swift"],"latest_commit_sha":null,"homepage":"https://www.linkedin.com/in/annul","language":"Swift","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/orucanil.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,"governance":null}},"created_at":"2016-10-05T05:12:49.000Z","updated_at":"2023-03-06T17:36:20.000Z","dependencies_parsed_at":"2023-10-01T23:56:18.990Z","dependency_job_id":"a01bb8af-81fe-4348-b78c-e9098e27f413","html_url":"https://github.com/orucanil/ANWCacheManager","commit_stats":null,"previous_names":["orucanil/anwcachemanager"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/orucanil/ANWCacheManager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FANWCacheManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FANWCacheManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FANWCacheManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FANWCacheManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orucanil","download_url":"https://codeload.github.com/orucanil/ANWCacheManager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FANWCacheManager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013704,"owners_count":26085393,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","cachemanager","directory","ios","memcached","swift"],"created_at":"2024-11-11T06:18:32.032Z","updated_at":"2025-10-13T05:32:10.033Z","avatar_url":"https://github.com/orucanil.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ANWCacheManager\n\nMemory friendly caching in directory and simple use user defaults methods. Every cached object has a life cycle and it will be deleted when it expires. It uses the memory and file directory in a complex and effective way.\n\n\nInstallation\n--------------\n\nTo use the ANWCacheManager in an app, just drag the ANWCacheManager files in Classes folder (demo files and assets are not needed) into your project. Add \"#import \u003cCommonCrypto/CommonCrypto.h\u003e\" into Bridging-Header.\n\n\nProperties\n--------------\n\nThe ANWCacheManager has the following properties (note: for iOS, NSObject when using properties):\n\n    static let instance = ANWCacheManager()\n\nInstance object. (Singleton)\n\n    private static let kDefaultCacheMaxCacheAge: Double = 60 * 60 * 24 * 7; // 1 week\n\nThe default value is 1 week.\n\n\nMethods\n--------------\n\nThe ANWCacheManager has the following methods (note: for iOS, NSObject in method arguments):\n\n    func setImage(image: UIImage?, key: String)\n\nSave image to memory and file directory.\n\n    func setObject(object: AnyObject?, key: String)\n\nSave object to memory and file directory.\n\n    func setData(data: NSData, key: String)\n\nSave data to memory and file directory.\n\n    func object(key: String) -\u003e AnyObject?\n\nGet object from memory or file directory.\n\n    func image(key: String) -\u003e UIImage?\n\nGet image from memory or file directory.\n\n    func isHaveObject(key: String) -\u003e Bool\n\nThis object is checked from key in memory or file directory.\n\n    func removeObject(key: String?)\n\nRemove object from memory or file directory.\n\n    func clearDisk()\n\nDelete all objects in file directory.\n\n    func writeToUserDefaults(object: AnyObject, key: String) -\u003e Bool\n\nWrite object to user defaults.\n\n    func removeFromUserDefaults(key: String) -\u003e Bool\n\nRemove object from user defaults.\n\n    func readFromUserDefaults(key: String) -\u003e AnyObject?\n\nGet object from user defaults.\n\n    func saveCache(object: AnyObject, key: String)\n\nSave object to memory.\n\n    func readCacheObject(key: String) -\u003e AnyObject?\n\nGet object from memory.\n\n\nHow to use ?\n----------\n\n```Swift\n\n\nlet photoURL: String = \"demo.url\"\n\n// Remove to file directory\nANWCacheManager.instance.removeObject(key: photoURL)\nlet dataKey: String = \"demo.key\"\n\n// Remove to user defaults\nANWCacheManager.instance.removeFromUserDefaults(key: dataKey)\n\n// Save to file directory\nlet data: String = \"demo.key\"\nANWCacheManager.instance.setObject(object: data, key: dataKey)\n\n// Save to file directory\nlet imageName: String = \"demo.image.name\"\nlet imageKey: String = \"demo.image.key\"\nANWCacheManager.instance.setImage(image: UIImage(named: imageName), key: imageKey)\n\n// Remove to file directory\nANWCacheManager.instance.removeObject(key: imageKey)\n\n// Save to user defaults\nANWCacheManager.instance.writeToUserDefaults(object: data, key: dataKey)\n\n\n```\n\nBuild and run the project files. Enjoy more examples!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forucanil%2Fanwcachemanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forucanil%2Fanwcachemanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forucanil%2Fanwcachemanager/lists"}