Coder Social home page Coder Social logo

awesomecache's People

Contributors

alenofx avatar aschuch avatar fernandodev avatar gilesvangruisen avatar javisoto avatar kamilpowalowski avatar klaaspieter avatar koutalou avatar nachosoto avatar niklassaers avatar notohiro avatar nyoho avatar readmecritic avatar regnerjr avatar rmzr7 avatar spenceratkin avatar sunbohong avatar vkt0r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

awesomecache's Issues

Unresolved Identifier in Cache.swift File

Hello, I installed AwesomeCache into my Xcode project through the manual installation method; however, when I attempt to run my program, there is an error in the Cache.swift file that says " Use of unresolved identifier '_awesomeCache_unarchiveObjectSafely' " (Line 235 in the file). Is there a fix for this or is this possibly an issue that resulted from using the manual installation? Thanks!

Is usable to cache downloaded files ?

Hello,
is this library usable for caching different type of contents downloaded from internet like images, videos, doc, pdf, etc ?
Can I
cache[hashfile] = contents of file ?

thanks

Confusing API caching method names

Hey there,

I love awesomecache though I ran into something interesting the other day. I was looking at a cache I had written for some API and because of the naming convention for setObjectForKey("name", cacheBlock: {}, completion: {}, I thought I was never checking this cache for the object before I was running the cacheBlock. I realized how this actually works later when I referred to the github page again and I re-read the example: "If the cache already contains an object, the completion block is called with the cached object immediately."

This would probably be more clear if it was named checkObjectForKey or something similar. That better represents that the function doesn't just blindly run and set the object, but rather checks the cache and can hit completion immediately.

How to use cache my Class?

Hi,
How to use cache with my class?
I saved "my name" cache then get name from cache. It is incorrect.
Please help me.
Thanks, Huy.

EX:
class myclass : NSObject, NSCoding {
private var _name:String = ""
func setName(name:String) { self._name = name }
func getName() -> String { return self._name }
override init() {}
required init(coder aDecoder: NSCoder) { }
func encodeWithCoder(_aCoder: NSCoder) { }
}

MyViewController
let KEY_CACHE = "myapp"
do {
let cache = try Cache(name: KEY_CACHE)
if let rs = cache.objectForKey("test") {
log( " --------- Loaded ------------- ")
let name = rs.getName() //Incorrect: Name is empty.
} else {
log( " --------- Nil ------------- ")
let x:myclass = myclass()
x.setName("my name")
cache.setObject(x, forKey: "test")
}
} catch {

}

How do we call "public class Cache<T: NSCoding> "

i am trying like this
AwesomeCache.Cache(name: name, directory: cachePath)

but it's throwing me an error 'NSCoding' cannot be used as a type conforming to protocol 'NSCoding' because 'NSCoding' has static requirements

watchOS Support

When running pod install, Cocoapods shows the error

[!] The platform of the target 'TJIntranetWatch Extension' (watchOS 2.0) is not compatible with
'AwesomeCache (2.0)', which does not support 'watchos'.

Does AwesomeCache not support watchOS, or is there something missing from the Podspec?

Deadlocking on removeAllObjects and removeExpiredObjects

Calling removeAllObjects and removeExpiredObjects causes a deadlock

The issue happens since they call dispatch_async on the diskQueue, and that closure calls dispatch_sync on the same queue. That first closure never returns due to dispatch_sync blocking. Deadlock :(

The easiest fix is for these methods to call dispatch_async on a different queue.

How do we cache API calls?

Hi. I want to say that AwesomeCache has been really helpful so far with caching images. I'm kinda new to programming and now I have to deal with APIs. I see that we can use this to cache the API calls but I don't understand how to declare the cache.

let cache = Cache<UIImage>(name: "awesomeCache")

What do I put instead of UIImage? I'm using Alamofire and SwiftyJSON to make the request and then read it. In what format can I cache the response? Is it possible to cache the JSON object?

Thanks in advance!

Get all objects?

Is there a way to grab all objects from the cache or can they only be accessed by key?

Carthage build error

I added

github "aschuch/AwesomeCache" "master"

to my Cartfile and run carthage update --platform iOS then
I got this error:

*** Building scheme "AwesomeCache-iOS" in Example.xcodeproj
** BUILD FAILED **

The following build commands failed:
    CompileSwift normal arm64
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)
/path/to/my/project/Carthage/Checkouts/AwesomeCache/AwesomeCache/AwesomeCache.h:20:9: error: include of non-modular header inside framework module 'AwesomeCache'
<unknown>:0: error: could not build Objective-C module 'AwesomeCache'
A shell task (/usr/bin/xcrun xcodebuild -project /path/to/my/project/Carthage/Checkouts/AwesomeCache/Example.xcodeproj -scheme AwesomeCache-iOS -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **

AwesomeCache does not build Swift 1.2 as default.

I just inserted

github "aschuch/AwesomeCache" 

into my Cartfile and did a carthage update. Carthage did not installed the current master as default but the last tagged Version which is the Swift 1.1 Tag.

*** Checking out AwesomeCache at "swift-1.1"

changing the Cartfile to

github "aschuch/AwesomeCache" "master"

checked out the master branch.

And the Swift-1.1 tag does not build at my environment at all. I get the following error messages:

2015-06-03 10:04:31.213 xcodebuild[3478:43851] [MT] PluginLoading: Required plug-in compatibility UUID E969541F-E6F9-4D25-8158-72DC3545A6C6 for plug-in at path 'Patoh to Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs

Tests fail to run

Tests fail with the following error:

screenshot 2014-07-29 15 07 38

AwesomeCache.swift and AwesomeCacheObject.swift should be added to the test target.

PR will follow.

Thanks for this!

I was previously using Haneke Swift for caching but between mystery crashes and general lack of updates I've been looking for something to replace it.

I just replaced all my Haneke code with AwesomeCache and I'm really liking it so far. The API for AwesomeCache is much more straightforward and I was able to simplify a fairly complex Haneke flow for something I like much better! In particular the Awesome API Caching is aptly named!

The only thing I miss is the UIImageView category to easily set images in a shared image cache but I'm sure that'll appear eventually, I may even hack on something this weekend.

Anyway, thanks!

Remove object synchronously

I think it's good if we have an option to remove/clear objects synchronously.
The scenario is that i know the cache is no longer valid and i want to make sure that i don't fetch from it until i completely remove all objects.

iPhone 4 with iOS 7.1 crash EXC_BAD_ACCESS

var cache = try! Cache<NSString>(name: "cache")

The app always crashes on this line. Only EXC_BAD_ACCESS. Nothing more.

Tried setting breakpoints in Cache class itself, could not reach them

objective c

is there any objective c version like this
thanks

Going from vendoring -> frameworks gives "cannot decode object of class"

For whatever reason (probably Swift 2) I had originally included just the source files of AwesomeCache and I have a bunch of cache files created.

When I reworked some of my project files, I moved AwesomeCache to build as a framework. Now I get "cannot decode object of class" crashes from NSKeyedArchiver because the identifiers have moved from [projectid].CacheObject to AwesomeCache.CacheObject.

I can just use the source files so not a huge deal for me, but I'm wondering if AwesomeCache can do anything to prevent this? Not attempting to decode objects with incorrect IDs would be a minimal fix, but being able to detect and use the alternate IDs is optimal.

Cache is empty when application quit and run background

Hi !
I have a class "CacheUtilities" i use it for stock a Static Cache of UIImage.
I have a lot of image to load from my server, so i want load it just one time and keep it on my Cache (except if user close the process of my app ! )

But i have a problem, when the user only close my app (not kill the app, just quit and make it run in background) and come back, my Cache is empty and i need to reload all images... What's the solution ?

I use the expires .Never

CacheUtilities.getCacheImage().setObject(UIImage(data: data)!, forKey: sUrl, expires: CacheExpiry.Never)

Cache encryption

Is there a way to apply encryption to the file saved on the disk?

I know about the data that are stored inside but is there a way to actually encrypt the file?

Not working with Swift 3.0

Not compiling with the Swift 3.0. I used Xcode 8.0 default migration tool to convert in Swift 3.0 but still no luck. Please find below error image for reference.

swift3 0_error

'NSCoding' cannot be used as a type conforming to protocol 'NSCoding' because 'NSCoding' has static requirements.

Hi i am calling cache data like
return AwesomeCache.Cache(name: name, directory: cachePath)

and it's show me error like :
'NSCoding' cannot be used as a type conforming to protocol 'NSCoding' because 'NSCoding' has static requirements.

i am sure that there might be some syntax calling problem , can you please guide for the same , i am using swift 2 as a language with latest version of awesome cache.

More documentation needed

Exactly what does the cache use to store data on disk? Is it CoreData, plain sqlite, even plainer files, is it something else altogether? What are the pros/cons of the system used? The answer to this question belongs in the README.

Permission on cache files

Hi,
thanks for making AwesomeCache - I really like it. :-)

But, I'm having a number of crashes, and they are almost always related to writing or reading files. My hypothesis is that the user has locked his or her device, and the device requires a passcode or touch id to unlock. The default now would be that access to files for threads running in the background is locked. I do background fetch, grab some data of the network, and cache the parts I need. During the operation, I also look up items from the cache. When it hits the disk, and reads or writes them from there, what permissions do they have? Can I set them myself? Perhaps on a cache-by-cache level? For these caches, the data isn't sensitive at all, so I can grant them full read/write / no security.

Cheers

Nik

Huge cache size

We are using AwesomeCache and it's great.

Now I implemented it for some bigger images and suddenly noticed a crazy amount of disk usage.

A picture with 414kb takes up almost 5MB on disk (Caches/com.aschuch.cache/images/xxx.cache). Is this something expected?

Help would be much appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.