GithubHelp home page GithubHelp logo

yoursoultree / localcacheloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shvilam/localcacheloader

0.0 2.0 0.0 532 KB

Adobe Air LocalCacheLoader Will save file in the filesystem and then retrieve it from there. Persistent manger

Home Page: http://shvilam.github.io/LocalCacheLoader/

License: MIT License

localcacheloader's Introduction

It is Adobe Air library written in AS3 for caching content (swf,images,data file) to the local file system.

The library is fully compatible with Loader / URLLoader/ NetStream and it try to be a very light weight version of the browser cache.

By using this class , the content (images/text and video) will be fetch from server once and save locally, Then every time that url will request again the library first check the file system to see if that file exsist on the file system and if so the libary will serve the local file.

As a result, it can reduce to the minmun communication with the server by requesting the same file over and over again.

The usage is exactly the same as Loader / URLLoader / NetStream. it's only requires 3 Lines of code.

    1. Specifying the application main cache directory.<br>
    2. Passing the  LocalCacheLoader, LocalCacheURLLoader, LocalCacheNetStream.
    3. Using the factory to create instances for those classes. <br>

p.s It is not obligatory to use a Factory class to generate the local loader classes.

Code Example

Let's look at an example even that it is quite easy to understand. File is in sample/main.as

// Setup cache Directory.
// Can be cached in the directory that you specify here .
LocalCacheSettings.WORKING_DIRECTORY = File.applicationDirectory;
    
// Please set the following: If AIR for Android, the AIR for iOS.
// LocalCacheSettings.WORKING_DIRECTORY = File.applicationStorageDirectory;
 
// Init Factory Class.
// Loader like normal will be used if you do not initialize the factory class .
NetClassFactory.initialize (LocalCacheLoader, LocalCacheURLLoader, LocalCacheNetStream);
 
/ Create Class.
// If true the second argument here , regardless of there without a cache that is stored in the local
// I will take the file from the Web always on .
_loader = NetClassFactory.createLoader (null, false);
 // I use normally after .
 _loader.contentLoaderInfo.addEventListener (Event.COMPLETE, _onComplete);
_loader.load (new URLRequest ("https://www.google.co.jp/images/srpr/logo11w.png"));

Help is needed!

For the NetStream loader it doesn't have the optimal solution it first save the file to local disc and then play. t will be perfect if it could buffer the stream and in end create file out of it.

Next version

  • Create a manger that will handel the the amout of space that is been used for cacheing

Fork from https://github.com/sgmnt/LocalCacheLoader It has been fork mailly for translation resone (from japanis)

localcacheloader's People

Contributors

shvilam avatar sgmnt avatar hrfm avatar

Watchers

James Cloos avatar JEONG WON UNG avatar

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.