<commit_before>.. _quickstart:

Quickstart
==========

This page gives a introduction to RC.


A Simple Example
----------------

A minimal cache example looks like this::

    from rc import Cache

    c = Cache()
    c.set('key', 'value')
    assert c.get('key') == 'value'
    assert c.get('foo') is None

What we are doing here?

1. First we imported the :class:`~rc.Cache` class.  An instance of this class
   can be used to cache things with a single redis server.
2. pass


Build A Cache Cluster
---------------------

pass


Cache Decorator
---------------

pass


Batch Fetch Multiple Cache Results
----------------------------------

pass


Cache Invalidation
------------------

pass<commit_msg>Added more docs for quickstart<commit_after>.. _quickstart:

Quickstart
==========

This page gives a introduction to RC.


A Simple Example
----------------

A minimal cache example looks like this::

    from rc import Cache

    cache = Cache()
    assert cache.set('key', 'value')
    assert cache.get('key') == 'value'
    assert cache.get('foo') is None

What we are doing here?

1. First we imported the :class:`~rc.Cache` class.  An instance of this class
   can be used to cache things with a single redis server.
2. pass


Build A Cache Cluster
---------------------

::

    pass


Cache Decorator
---------------

::

    @cache.cache()
    def load(name, offset):
        return load_from_database(name, offset)

    rv = load('name', offset=10)


Batch Fetch Multiple Cache Results
----------------------------------

::

    pass


Cache Invalidation
------------------

::

    cache.delete('key')
    # for decorated function
    cache.invalidate(load, 'name', offset=10)
{'fraction_non_alphanumeric': 0.21133412042502953, 'fraction_numerical': 0.004722550177095631, 'mean_word_length': 1.9581151832460733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2086585', 'n_tokens_mistral': 490, 'n_tokens_neox': 461, 'n_words': 183}