GithubHelp home page GithubHelp logo

rallahaseh / racaching Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 57 KB

The purpose of the library is to abstract the downloading (images, pdf, zip, etc) and caching of remote resources (images, JSON, XML, etc) in-memory.

License: MIT License

Ruby 2.72% Objective-C 2.25% Shell 31.39% Swift 63.65%

racaching's Introduction

RACaching

CI Status Version License Platform

The purpose of the library is to abstract the downloading (images, pdf, zip, etc) and caching of remote resources (images, JSON, XML, etc) in-memory.



Usage

Import the framework

import RACaching

Extend RAURLObserverProtocol to the class and define a RAResourceManager, which loads all the resources you need from http/https.
Resource Manager:

  • Checks where corresponding resource for a URL in cache using cacheManager, if the resource is not found it checks if already downloading by the downloadsManager.
  • If the resource is not found then it creats resource and initialises download for that resource with adding observers for that resource.
  • If the resource is found in cache it sends the data back to the observer.
  • If the resource is found in the downloadsManager then it adds the observer to the list of resource observer.

Then use

open func getDataFor(_ urlString:, withIdentifier identifier:, withUrlObserver observer:)

Where it checks if the resource of the URL exists or not to creates new resource if not, the identifier here to add observers to a resource and delete it if object does not need data and the observer communicate the status of data fetch from Cache or Server

Installation

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

pod 'RACaching'

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

rallahaseh, [email protected]

License

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

racaching's People

Contributors

rallahaseh avatar

Stargazers

 avatar  avatar Carabineiro avatar

Watchers

Carabineiro avatar  avatar

Forkers

carabina

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.