Skip to content

Instantly share code, notes, and snippets.

@fitomad
Last active May 28, 2019 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/43d15e8b3e49763590d764635fc4bcee to your computer and use it in GitHub Desktop.
Save fitomad/43d15e8b3e49763590d764635fc4bcee to your computer and use it in GitHub Desktop.
/**
Añade una cita a la caché.
El usuario nos pasa un `Data` como valor un `String`
con el nombre del recurso que representa la cita.
Los convertimos en un NSData y NSString respectivamente
para operar con nuestra caché.
- Parameters:
- quote: Los bytes que representan la cita
- key: La clave por la que buscamos la imagen
*/
public func add(_ quote: Data, forKey key: String) -> Void
{
let theData = quote as NSData
let theKey = key as NSString
self.cache.setObject(theData, forKey: theKey)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment