Giter Site home page Giter Site logo

cachemanager's Introduction

CacheManager

  • object 단위로 캐쉬를 사용할수 있게 함.
  • lifeTime을 지정하여 캐쉬 item의 만료 시간을 지정할 수 있음.
  • 도메인 단위로 캐쉬 유지 가능

사용법

var cacheManager = new CacheManager();
cacheManager.setItem('myDate', new Date());
var date = cacheManager.getItem('myDate');
var allCache = cacheManager.getAll();

setItem(name, item, timer)

캐시에 데이터를 저장함

  • name(require)
  • 캐시할 item 이름(string)
  • item(require)
  • 캐시랑 item (object, string ...anyting)
  • timer(option)
  • 지정할 lifeTime 지정 하지 않으면 session에만 cache 적용
  • 0: 만료시간 없음 계속 살아있음
  • number: 해당되는 숫자의 timestamp(milliseconds) 이후에 만료
  • Date: 해당되는 Date에 만료

getItem(name, deleteItem)

캐시에서 데이터를 가져옴

  • name(require)
  • 가져올 캐시 이름
  • deleteItem(option)
  • true|false 가져온 이후 아이템 삭제여부 default false

removeItem(name)

캐시에서 데이터를 삭제

  • name(require)
  • 삭제할 캐시 이름

getAll()

저장된 캐시를 모두 가져옴(CacheManager로 저장된 캐시)

  • 저장된 캐시를 모두 가져옴
  • return Array

cachemanager's People

Contributors

kwon1983 avatar

Watchers

 avatar  avatar  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.