Latest 0.1.0
Homepage https://github.com/mihyaeru21/Siegel
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

A simple implementation of LRU cache written in Swift.
This library is inspired by Cache::LRU.

Usage

let cache = Siegel<Int?>(size: 3)

// set
cache.set(key: "a", value: 1)
cache.set(key: "b", value: 2)
cache.set(key: "c", value: nil)
cache.set(key: "d", value: 4)

// get
cache.get(key: "a")      // => nil
cache.get(key: "b")      // => 2
cache.get(key: "c")      // => nil
cache.get(key: "4")      // => 4

// exists
cache.exists(key: "a")   // => false
cache.exists(key: "b")   // => true
cache.exists(key: "c")   // => true (if using optional type, it can contain nil)
cache.exists(key: "d")   // => true
cache.exists(key: "e")   // => false

// remove
cache.remove(key: "b")
cache.get(key: "b")      // => nil
cache.exists(key: "b")   // => false

// clear
cache.clear
cache.exists(key: "a")   // => false
cache.exists(key: "b")   // => false
cache.exists(key: "c")   // => false
cache.exists(key: "d")   // => false
cache.exists(key: "e")   // => false

// subscript
cache["s"] = 10
cache["s"]       // => 10

Installation

Siegel is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Siegel'

Author

Mihyaeru, [email protected]

License

Siegel is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Siegel",
    "version": "0.1.0",
    "summary": "A simple implementation of LRU cache.",
    "description": "                   A simple implementation of LRU cache written in Swift.n                   This library is inspired by [Cache::LRU](https://metacpan.org/pod/Cache::LRU).n",
    "homepage": "https://github.com/mihyaeru21/Siegel",
    "license": "MIT",
    "authors": {
        "Mihyaeru": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mihyaeru21/Siegel.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*"
}

Pin It on Pinterest

Share This