Swiftpack.co - TySchultz/SwiftStore as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by TySchultz.
TySchultz/SwiftStore 1.0.0
Lightweight Caching Library
⭐️ 0
🕓 3 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/TySchultz/SwiftStore.git", from: "1.0.0")

Logo

SwiftStore

Swift Package Manager platforms platforms

Lightweight Caching Library for Swift. Inspired by Swift By Sundell.

Table of Contents

Why?

Making an app feel fast and responsive isn’t only about tweaking the way its UI is rendered, or improving the sheer execution speed of its operations and algorithms — it’s often just as much about efficiently managing its data and avoiding unnecessary work.

Many apps do not need an expansive database for managing the data. An efficent implementation that works easily with the Codable protocol is likely more than enough for your average application. The main goal of any software is to create quickly with readability and replaceability. This package is intended to do that, while allowing extensibility if needed.

Features

  • 💪 Elegant caching API in Swift
  • 🎯 Lightweight and easy to use.
  • 🎨 Create Custom Modifiers.

TODO

Structure

  • Unit Tests - Full Code Coverage
  • Github repo
  • Swift Package Support

Nice to have

  • add policyTracker
    • Policys for how entries are inserted/retrieved
  • Cache status property (e.g. fresh, expired)
  • Expiration callback on cache load
  • Allow retrieving objects based on predicates
  • implement countlimit
    • what happens when trying to insert past the count limit
  • Create a protocol describing behavior based on caching events
    • for example, a callback for expired data or callback for successfully retrieving from cache
  • pass in encryption policy or encryption provider

At a Glance

Example 😊

  let name  = "SwiftStore"
  let key   = "key"
  let store = Cache<String,String>()
  store.insert(name, forKey: key)

  // Then
  let result = store[test.id]
  // or 
  let result = store.value(forKey:key)

Installation

Publish is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/TySchultz/SwiftStore.git", from: "0.1.0")
    ],
    ...
)

Then import Publish wherever you’d like to use it:

import SwiftStore

For more information on how to use the Swift Package Manager, check out this article, or its official documentation.

GitHub

link
Stars: 0
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Initial
4 years ago

First

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics