Lily is a lightweight swift cache framework.
- With Lily, cache can be done in ease.
- Lily provide both memory and disk level cache with same sytax.
In your Podfile (note that it require CocoaPods 0.36 or later):
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Lily'
Carthage is a decentralized dependency manager for Cocoa application.
To integrate Lily into your Xcode project using CocoaPods, specify it in your Cartfile
:
github "kukushi/Lily"
It is not recommended to install the framework manually, but if you prefer not to use either of the aforementioned dependency managers, you can integrate Lily into your project manually. A regular way to use Lily in your project would be using Embedded Framework.
- Add Lily as a submodule. In your favorite terminal,
cd
into your top-level project directory, and entering the following command:
$ git submodule add https://github.com/kukushi/Lily.git
- Open the
Lily
folder, and dragLily.xcodeproj
into the file navigator of your app project, under your app project. - In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
- In the tab bar at the top of that window, open the "Build Phases" panel.
- Expand the "Target Dependencies" group, and add
Lily.framework
. - Click on the
+
button at the top left of tdemohe panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and addLily.framework
.
MemoryCache cache in the memory level. When the App is terminated, all is gone.
// Save integer 1 with key "poi" in the default context using the memory cache
MemoryCache["poi"] = 1
// Retrive the content with key "poi" in the default context from the memory cache
let poi = MemoryCache["poi"].intValue
// If you want to do something in other context, just add other key.
// Save string "hey" with "poi" key in the "You" context
MemoryCache["poi", "You"] = "hey"
// retrive the content of "poi" key in the "You" context
let poiYou = MemoryCache["poi", "You"].stringValue
MemoryCache
do it's work on the memory level. When the App is terminated, all the content will be removed.
QuickCache
is base on MemoryCache
. It'll write all the content into disk in the right time at a whole.
DiskCache
is base on MemoryCache
, too. It do the disk level cache every time you modify content for a key.
- iOS 8.0 or later
- Xcode 7.0 or later
Lily is released under the MIT license. See LICENSE for details.