Giter Site home page Giter Site logo

iron_cache_python's Introduction

IronCache Python Client

IronCache is a scalable, managed cache from Iron.io.

Getting Started

Get Credentials

To use IronCache, you need to sign up and get your OAuth token.

Install iron_cache_python

You can install iron_cache_python in two ways:

pip/easy_install

iron_cache_python is available in the Python Package Index as "iron_cache". This means you can run pip install iron_cache or easy_install iron_cache from your command line to download iron_cache_python and all its dependencies.

From Source

You can also download the source from Github. Once you have the source, you can run python setup.py install from the directory containing the source code to install iron_cache_python.

Note: You will need the iron_core_python module for iron_cache_python to function.

Configure Your Client

iron_cache_python conforms to the standard Iron.io configuration scheme that all official libraries use. This means your config files will work across languages and products.

Put Items In the Cache

from iron_cache import *

cache = IronCache()
item = cache.put(cache="test_cache", key="mykey", value="Hello IronCache!")
print item.value

Get an Item In the Cache

from iron_cache import *

cache = IronCache()
try:
    item = cache.get(cache="test_cache", key="mykey")
except:
    item = None    
print item.value if item else print None

Increment an Item's Value

from iron_cache import *

cache = IronCache()
cache.increment(cache="test_cache", key="mykey", amount=10)

Delete an Item From the Cache

from iron_cache import *

cache = IronCache()
try:
    cache.delete(cache="test_cache", key="mykey")
except:
   pass

License

This software is released under the BSD 2-Clause License. You can find the full text of this license under LICENSE.txt in the module's root directory.

More Documentation & Support

More documentation can be found in the Iron.io Dev Center.

Iron.io offers a public support chatroom that is staffed by employees around the clock. We would be more than happy to assist you.

iron_cache_python's People

Contributors

alyssaq avatar asl97 avatar edsrzf avatar featalion avatar goshiplabs avatar rkononov avatar treeder avatar ulandj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iron_cache_python's Issues

Python 3 support - NameError: name 'basestring' is not defined

I get the following error

File "/home/user/virtualenv/lib/python3.4/site-packages/iron_cache.py", line 117, in put if not isinstance(value, basestring) and not isinstance(value, NameError: name 'basestring' is not defined

when I try to PUT a key:

def put(self, key, value, cache=None, options={}):
      ...
       if not isinstance(value, basestring) and not isinstance(value,
                (int, long)): 
            value = json.dumps(value)

       ...

Should basestring be replaced with str?

exceptions for delete\get methods

now IronCache raises requests.exceptions.HTTPError for cache.get and cache.delete on non-existing keys, i think will be awesome if cache.get will return None and cache.delete False for non-existing keys

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.