<commit_before>.. django-pages-cache documentation master file, created by
   sphinx-quickstart on Sun Jul 10 14:16:19 2016.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to django-pages-cache's documentation!
==============================================


Install
=======

settings
-----------
`
MIDDLEWARE_CLASSES = [
    # add middleware
    'pages_cache.middleware.PagesRequests.GetPageRequest'
]
`
Getting Started
===============

Using class CacheViews
----------------------

`
from django.shortcuts import render

# Django pages cache
from pages_cache.pages_decorators import CacheViews

# Create your views here.

register = CacheViews( )

@register.cache_view( key_prefix='home-index' )
def home( request ):

    return render( request, 'index.html' )
`   

Using class CacheViews with expire
----------------------------------

`
from django.shortcuts import render

# Django pages cache
from pages_cache.pages_decorators import CacheViews

# Create your views here.

register = CacheViews( )

@register.cache_view( 
        key_prefix='home-index', 
        expire=60 * 15 
    )
def home( request ):

    return render( request, 'index.html' )
`<commit_msg>index<commit_after>.. django-pages-cache documentation master file, created by
   sphinx-quickstart on Sun Jul 10 14:16:19 2016.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to django-pages-cache's documentation!
==============================================


Install
=======

settings
--------

MIDDLEWARE_CLASSES = [
    # add middleware
    'pages_cache.middleware.PagesRequests.GetPageRequest'
]

Getting Started
===============

Using class CacheViews
----------------------


from django.shortcuts import render

# Django pages cache
from pages_cache.pages_decorators import CacheViews

# Create your views here.

register = CacheViews( )

@register.cache_view( key_prefix='home-index' )
def home( request ):

    return render( request, 'index.html' )
 

Using class CacheViews with expire
----------------------------------


from django.shortcuts import render

# Django pages cache
from pages_cache.pages_decorators import CacheViews

# Create your views here.

register = CacheViews( )

@register.cache_view( 
        key_prefix='home-index', 
        expire=60 * 15 
    )
def home( request ):

    return render( request, 'index.html' )

{'fraction_non_alphanumeric': 0.17571371129875352, 'fraction_numerical': 0.012866907921190189, 'mean_word_length': 3.216949152542373, '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': '619775', 'n_tokens_mistral': 745, 'n_tokens_neox': 674, 'n_words': 214}