Skip to content

Commit

Permalink
Remove unused StorageBackend protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Dec 13, 2018
1 parent ccc9416 commit c375b89
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Sources/Cache/DiskStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public enum DiskStorage {
/// You can config a `DiskStorage.Backend` in its initializer by passing a `DiskStorage.Config` value.
/// or modifying the `config` property after it being created. `DiskStorage` will use file's attributes to keep
/// track of a file for its expiration or size limitation.
public class Backend<T: DataTransformable>: StorageBackend {
public class Backend<T: DataTransformable> {
/// The config used for this disk storage.
public var config: Config

Expand Down
2 changes: 1 addition & 1 deletion Sources/Cache/MemoryStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum MemoryStorage {
/// date. When retrieved, if the target item is already expired, it will be recognized as it does not
/// exist in the storage. The `MemoryStorage` also contains a scheduled self clean task, to evict expired
/// items from memory.
public class Backend<T: CacheCostCalculable>: StorageBackend {
public class Backend<T: CacheCostCalculable> {
let storage = NSCache<NSString, StorageObject<T>>()
var keys = Set<String>()

Expand Down
13 changes: 0 additions & 13 deletions Sources/Cache/Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,6 @@ public enum StorageExpiration {
}
}

protocol StorageBackend {
associatedtype ValueType
associatedtype KeyType
func store(
value: ValueType,
forKey key: KeyType,
expiration: StorageExpiration?) throws
func value(forKey key: KeyType) throws -> ValueType?
func remove(forKey key: String) throws
func removeAll() throws
func isCached(forKey key: String) -> Bool
}

/// Represents types which cost in memory can be calculated.
public protocol CacheCostCalculable {
var cacheCost: Int { get }
Expand Down

0 comments on commit c375b89

Please sign in to comment.