Saravanan666/pypi-org huggingface dataset:
Package: django-cache-manager-redux
django-cache-manager=====================Simple cache manager for django models that caches querysets for a model. Cache manager will cache any query that has been seen for a model. Model cache is evicted for any updates/deletes to the model. This manager is useful for models that don't change often.[![Build Status](https://travis-ci.org/vijaykatam/django-cache-manager.svg?branch=master)](https://travis-ci.org/vijaykatam/django-cache-manager)[![Coverage Status](https://img.shields.io/coveralls/vijaykatam/django-cache-manager.svg)](https://coveralls.io/r/vijaykatam/django-cache-manager)[![PyPI version](https://badge.fury.io/py/django-cache-manager.svg)](https://badge.fury.io/py/django-cache-manager)## Installation```shpip install django-cache-manager```### Caching strategy* Cache results for a model on load.* Evict cache for model on update.## UsageAdd to installed apps```INSTALLED_APPS = (...'django_cache_manager',...)```Define cache backend for `django_cache_manager.cache_backend` in `settings.py`. The backend can be any cache backendthat implements django cache API.```CACHES = {'django_cache_manager.cache_backend': {'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache','LOCATION': '127.0.0.1:11211',}}``````from django_cache_manager.cache_manager import CacheManagerclass MyModel(models.Model):#set cache manager as defaultobjects = CacheManager()```## Django shellTo run django shell with sample models defined in tests.```shmake shell```Sample models```from tests.models import Manufacturerfrom tests.models import Carfrom tests.models import Driverm = Manufacturer(name='Tesla')m.save()c = Car(make=m, model='Model S', year=2015)c.save()d = Driver(first_name ='ABC', last_name='XYZ')d.save()d.cars.add(c)drivers = Driver.objects.select_related('car', 'manufacturer').all()```## TestingTo run tests```shmake test```##### Supported Django versionsSupported - 1.5, 1.6, 1.7, 1.8, 1.9, 1.10History-------0.5.1---* Avoid spurious cache miss when query is empty* Fixed error: 'NoneType' object has no attribute `\_meta`0.5---* Add support for Django 1.100.4.1---------------------* Update requirements to Django<1.100.4---------------------* Support for django 1.90.3---------------------* Support for django 1.80.2---------------------* Use django.core.cache.caches available in django 1.7 for efficient cache backend access0.1.5---------------------* [BUGFIX] - Fix for non-ascii characters in query.0.1.4---------------------* [BUGFIX] - Fix cache eviction on bulk updates for models that have a ManyToManyField with an intermediate(through) model.0.1.3---------------------* [BUGFIX] - Fix cache eviction for models that have a ManyToManyField with an intermediate(through) model.0.1.2---------------------* [BUGFIX] - Properly handle passing of an empty iterable to '\__in' filter args.  Related Django bug: https://code.djangoproject.com/ticket/127170.1.1---------------------* [BUGFIX] - Invalidate related model caches for changes, needed for select_related queries.0.1.0---------------------* Test coverage* Cache invalidation for manytomany relation0.1.0-beta.1---------------------* First beta release
Package: django-cache-middleware
django-cache-middlewaredjango-cache-middleware is a Django app for the caching api data while get method and removing after data altered or created.Installation* pip install django-cache-middleware
* Add ``cache_middleware`` to your ``INSTALLED_APPS``
* Add ``cache_middleware.middlewares.CacheMiddleware`` to your ``MIDDLEWARE``
* set django redis for your project (https://pypi.org/project/django-redis/)::Setup in settings* REMOVE_RELATED_CACHE : bool # default True # remove related model data i.e o2m, m2o, m2m, 020 dat 
* CACHE_REMOVE_TIMEOUT : integer | None # default None # cache removing time
* BASE_API_URL : str # default /api/ # base api url
* CACHE_NAME : str # default settings.ROOT_URLCONF.split('.')[0] #  name of cache base key name::Compatibility{py37, py38, py310}-django{4.* above}
Package: django-cache-mock
django-cache-mockUse in-process mocks to avoid setting up external caches for Django during
development.Django has a limited built-indjango.core.cache.backends.locmem.LocMemCache,
to help development, but Django do some magic to always give you a working
connection.I have some reasons to abuse Django cache this way:Thread safety: Django spin one connection per thread to avoid issues with
thread unsafe drivers.Good defaults: Django run connections with good defaults.Connection reuse: Django already have a pool running and in most cases it is
better to use it.Install$pipinstalldjango-cache-mockAlso, it is possible to install with the backends you want.Formockcache, it installsmockcache3,
a fork from original package because it doesn´t work for new versions of Python.$pipinstalldjango-cache-mock[mockcache]$pipinstalldjango-cache-mock[fakeredis]$pipinstalldjango-cache-mock[redislite]How to useIn your Django settings you already haveCACHESdefined.Formemcached, it's something like that:CACHES={"default":{"BACKEND":"django.core.cache.backends.memcached.PyMemcacheCache","LOCATION":os.getenv("MEMCACHED_HOSTS"),"OPTIONS":{"no_delay":True,"ignore_exc":True,"max_pool_size":4,"use_pooling":True,},},}Just make a call todjango_cache_mock.patchto replace with a mock backend.The lib will patch only when cache LOCATION is not defined.importdjango_cache_mockifDEBUG:# Apply it only in debug mode to be extra careful.django_cache_mock.patch(CACHES,"default","mockcache")This patch replace cache with a mocked one. For mockcache,Custom cache optionsThepatchfunction accepts custom params. It can be used to override mock
behaviours, like the db fileredislitewill use, defined byLOCATION:django_cache_mock.patch(CACHES,"default","redislite",{"LOCATION":"data/redis.db"})Redis backendsRedis has several options to run. This lib implementsfakeredisandredislite,
withdjango.core.cacheordjango-redis.By default, the lib try to maintain the same behavior of the original implementation.
If config usesdjango-redis, when you set use backendfakeredis, it will use
it asfakeredis[django-redis].# Force to use django-redis. It is not necessary, the lib already try to use# django-redis if cache uses `django_redis.cache.cache.RedisCache`.django_cache_mock.patch(CACHES,"redis","fakeredis[django-redis]")django_cache_mock.patch(CACHES,"redis","redislite[django-redis]")How to access connectionsTo get Django memcached and redis clients from cache:fromdjango.core.cacheimportcachesdefgive_me_memcached():returncaches["memcached"]._cache# for django.core.cache.backends.redisdefgive_me_primary_redis():returncaches["redis"]._cache.get_client(write=True)defgive_me_secondary_redis():returncaches["redis"]._cache.get_client()# for django-redisdefgive_me_primary_redis():returncaches["redis"].client.get_client()defgive_me_secondary_redis():returncaches["redis"].client.get_client(write=False)# Yes, django and django-redis have different write flag defaults.
Package: django-cache-page-per-user
django-cache-page-per-userExtending the Django'scache_pagedecorator.
Supports caching per user and per language.
Support custom settings and clearing cache.Support of cachesdjango_redis.cache.RedisCachedjango.core.cache.backends.locmem.LocMemCacheInstallationRunpip install django-cache-page-per-userUsageUse prefixes to group views by the common models they depend on.# constants.pyclassCachePrefixes:AUTHOR='AUTHOR'ARTICLE='ARTICLE'COMMENT='COMMENT'Use @cache_page_per_user like @cache_page, this decorator will cache responses with only safe methods and with status 200# view.pyfromcache_page_per_user.cacheimportcache_page_per_userfromdjango.utils.decoratorsimportmethod_decoratorfromconstantsimportCachePrefixes@cache_page_per_user(60*60,CachePrefixes.ARTICLE)defarticle_view(request,pk):...@cache_page_per_user(60*60,CachePrefixes.ARTICLE)defarticle_some_info_view(request,pk):...@cache_page_per_user(60*60,CachePrefixes.AUTHOR)defauthor_view(request,pk):...# for ViewSetclassCommentViewSet(ViewSet):...@method_decorator(cache_page_per_user(60*60,CachePrefixes.COMMENT))defretrieve(self,request,pk=None):...Create signals on the model, when changed, the cache will be reset# signals.py...fromcache_page_per_user.utilsimportclear_cachefromcache_page_per_user.utilsimportget_cache_keyfromconstantsimportCachePrefixesfrommodels.pyimportArticle...@receiver(post_save,sender=Article)@receiver(post_delete,sender=Article)defcreate_slug_wrapper(sender,instance,**kwargs):query=get_cache_key(CachePrefixes.ARTICLE,instance.author_id)clear_cache(query)
Package: django-cache-panel
The Django Cache Panel is an add-on for the Django Debug Toolbar to track cache
usage. It is a fork of theCache Debug Toolbarproject by Rick van Hattem, which is where the statistics tracking at the core
of this project come from. The generic cache wrapper is modified from thedjango-debug-cache-panelproject by Jeff Balogh.It’s been tested with Django 1.4 and Django Debug Toolbar 0.9.4 using the
python-memcached backend. If you’ve tried it out with other configurations,
please let me know!What’s Changed?The project has been modified to be more generic, capturing only the functions
found in the BaseCache so that it should be compatible with more cache
backends. The way the statistics are captured and the presentation of the
statistics has also been modified to be more similar to the SQL panel. The
requirement for the panel to be imported in settings has been removed.InstallationInstall and configureDjango Debug Toolbar.pip installdjango-cache-panelAddcache_panelapp to yourINSTALLED_APPS.Addcache_panel.panel.CacheDebugPaneltoDEBUG_TOOLBAR_PANELS.
Package: django-cachepurge
ContentsWhat is it?UsageModelsCache configurationHomepage, code, bug trackerContributorsChange history0.3 - 2011-04-010.2 - 2010-11-220.1a - 2009-05-25DownloadWhat is it?This package allows django to purge HTTP cache when a model instance is changed
or deleted. It does this by sending “PURGE” requests to one or more upstream
HTTP cache (such as Squid or Varnish). This is inspired by Plone CacheFu
components.UsageIn settings.py put ‘django_cachepurge’ before any other application; else it may
fail to register some models:INSTALLED_APPS = (
   'django_cachepurge',
   ...
)Add the middleware:MIDDLEWARE_CLASSES = (
    ...
    'django_cachepurge.middleware.CachePurge',
)Define CACHE_URLS:CACHE_URLS = 'http://127.0.0.1:3128'or if you have more than one cache:CACHE_URLS = ('http://127.0.0.1:3128',
              'http://192.168.1.42:3128')ModelsUrls are extracted from models instances on post_save signal. Two sources are
used:instance.get_absolute_url(), if it existsinstance.get_purge_urls(), if it exists. The application expects a list of
absolute paths similar to what is provided by get_absolute_url().Purge request is sent when response has been computed: if an exception occurs
the urls are not purged. Purge requests are asynchronous: worker threads handle
that so that we don’t have wait to complete all requests before returning the
response.Cache configurationThe cache must be configured to accept and handle “PURGE” requests from the
server where the django application is hosted.Homepage, code, bug trackerHomepage:http://launchpad.net/django-cachepurgeCode repository:http://code.launchpad.net/django-cachepurgeReport bugs athttp://bugs.launchpad.net/django-cachepurgeContributorsBertrand Mathieu, AuthorChange history0.3 - 2011-04-01Compatible with Django 1.3: don’t import django.utils.thread_supportcatch NoReverseMatch exception when trying to find an instance’s url0.2 - 2010-11-22Accept to purge only site urls, converted if needed into their relative form
(i.e, “/some/path/”)0.1a - 2009-05-250.1a: 0.1 released missed some filesInitial releaseDownload
Package: django-cache-results
django-cache-resultsA microlibrary to ease your caching code.Usage:defkey_function(arg1,arg2):returnf"prefix.{arg1}.{arg2}"@cache_results(key_function=key_function)defsome_function(arg1,arg2):return"COMPLEX DATA"Normal usage:value=some_function(1,2)Skipping the cache:value=some_function.bypass_cache(1,2)Updating the cache:value=some_function.refresh_cache(1,2)Fetch the key for manual action:cache_key=some_function.cache_key(1,2)InstallationInstall the module from PyPI:pipinstalldjango-cache-resultsAnd use it in your project:fromcache_resultsimportcache_resultsContributingWas there something you missed, or didn’t like about this module?
Send us a pull request!
Package: django-cache-stockpile
Stockpile provides limited automatic caching and invalidation for Django models
through the ORM. Objects fetched through.objects.get(pk=..)or.objects.get(id=..)are cached by the primary key. In addition, there is
a way to get objects with the methods.objects.pk_in(id_list)and.objects.id_in(id_list).RequirementsStockpile requires Django 1.3.  It was written and tested on Python 2.6.InstallationGet it from [pypi](http://pypi.python.org/pypi/django-cache-stockpile):`bash pip installdjango-cache-stockpile`or [github](http://github.com/streeter/django-cache-stockpile):`bash pip install-egit://github.com/streeter/django-cache-stockpile.git#egg=django-cache-stockpile`Running Tests`bash git clonegit://github.com/streeter/django-cache-stockpile.gitcddjango-cache-stockpilepip install-rrequirements.txt python runtests.py `
Package: django-cache-sweeper
Fragment cache invalidation by using a per model version token to prefix the cache keys. The version token can either be an internal memcached counter or a timestamped attribute from the model, such asupdated_at.InstallationInstall withpipor withpython setup.py installand add ‘cachesweeper’ to yoursettings.INSTALLED_APPSpost_save cache sweeperAn example setup; an article has many comments, each comment is cached, a single vote should invalidate the comment’s specific cached fragment as well as the total article’s page.Template fragment caching{% cachesweeper %}takes a Django ORM model as its first argument, the expiry time as its second and any following arguments are used to construct the rest of the cache key{% load markup %}
{% load cachesweeper_tags %}
{% cachesweeper comment 500 "comment.xml" %}
<p>
    <strong>{{comment.user}}</strong> said at {{comment.created_at}}:<br/>
    {{comment.content|markdown}}
    <br/>
    <a href={% url like article_id=article.pk,comment_id=comment.pk %}>Like ({{comment.likes.count}})</a>
    <a href={% url dislike article_id=article.pk,comment_id=comment.pk %}>Dislike ({{comment.dislikes.count}})</a>
</p>
{% endcachesweeper %}Invalidating the fragment when the model changesOn a post_save invalidate the cache for the given model. There are two options, either have Memcached keep an internal version counter for each model or using the keywordusingas a means of versioning the cache.from cachesweeper.utils import invalidate_cache_for

# using Memcached's internal counter
def invalidate_vote_cache(sender, **kwargs):
    vote = kwargs.get('instance')
    invalidate_cache_for(vote.comment)

post_save.connect(invalidate_vote_cache, sender=Vote)


# using a model's attribute
def invalidate_article_cache(sender, **kwargs):
    article = kwargs.get('instance')
    invalidate_cache_for(article, using='updated_at')

post_save.connect(invalidate_article_cache, sender=Article)
Package: django-cachetable
django-cachetable=================.. image:: https://img.shields.io/pypi/v/django-cachetable.svg:target: https://pypi.python.org/pypi/django-cachetable:alt: Latest PyPI version:crossorigin: anonymousUse Django admin to view cachetable.Installation------------You can install ``django-cachetable`` via `pip`_ from `PyPI`_::$ pip install django-cachetable.. _`pip`: https://pypi.python.org/pypi/pip/.. _`PyPI`: https://pypi.python.org/pypiUsage-----Add ``cachetable`` to ``INSTALLED_APPS``.
Package: django-cache-toolbox
django-cache-toolboxNon-magical object caching for Django.Another caching framework for Django that does not do any magic behind your
back, saving brain cycles when debugging as well as sticking to Django
principles.InstallationFromPyPI:pip install django-cache-toolboxBasic Usagefromcache_toolboximportcache_model,cache_relationfromdjango.dbimportmodelsclassFoo(models.Model):...classBazz(models.Model):foo=models.OneToOneField(Foo,related_name='bazz',primary_key=True)...# Prepare caching of a modelcache_model(Foo)# Prepare caching of a relationcache_relation(Foo.bazz)# Fetch the cached version of a modelfoo=Foo.get_cached(pk=42)# Load a cached relationprint(foo.bazz_cache)See the module docstrings for further details.
Package: django-cache-tools
Django Cache tools is a basic set of tools to built on top of the django cache framework
to make it easier to use and add caching related features.Tools includedKeyableModel: Model that has a cache_key to cache with.expire_page: Expire a page with a given path.@cache_page_in_group: Cache pages with a given group name so they can be expired all at one.DocumentationYou can find the docs athttp://django-cache-tools.readthedocs.org/.Running the TestsYou can run the tests with via:python runtests.py
Package: django-cache-utils2
django-cache-utils2 providescacheddecorator andinvalidatefunction.Installationpip install django-cache-utils2Usagefrom cache_utils2 import cached, invalidate

@cached(60)
def foo(x, y=0):
    print 'foo is called'
    return x+y

foo(1, 2) # foo is called
foo(1, y=2)
foo(5, 6) # foo is called
foo(5, 6)
invalidate(foo, {'x': 1, 'y': 2})
foo(1, 2) # foo is called
foo(5, 6)
foo(x=2) # foo is called
foo(x=2)

class Foo(object):
    @cached(60)
    def foo(self, x, y):
        print "foo is called"
        return x+y

obj = Foo()
obj.foo(1,2) # foo is called
obj.foo(1,2)

invalidate(Foo.foo, {'x': 1, 'y': 2})
obj.foo(1,2) # foo is calledDjango examplefrom django.db import models
from cache_utils2 import cached, invalidate

class CityManager(models.Manager):

    # cache a method result. 'self' parameter is ignored
    @cached(60*60*24)
    def default(self):
        return self.active()[0]

    # cache a method result. 'self' parameter is ignored, args and
    # kwargs are used to construct the cache key
    @cached(60*60*24)
    def get(self, *args, **kwargs):
        return super(CityManager, self).get(*args, **kwargs)


class City(models.Model):
    # ... field declarations

    objects = CityManager()

    # cache django model instance method result by instance pk
    @cached(30, vary='self.pk')
    def has_offers(self):
        return self.offer_set.count() > 0

# invalidation of model methods
invalidate(City.has_offers, {'self.pk': 1}NotesIf decorated function returnscache_utils2.NO_CACHEcache will be bypassed.Running testsGet the source code and runruntests.py.
Package: django-cache-with-mongodb
Django Cache With MongoDBInstallation and UsageInstall with:$ pip install django-cache-with-mongodbAdd the following to your Django settings::CACHES = {
    'default': {
        'BACKEND': 'django_cache_with_mongodb.MongoDBCache',
        "LOCATION": "[mongodb://][username:password@]host1[:port1][,...hostN[:portN]][/[defaultdb][?options]]",
        "OPTIONS": {
            "USERNAME": "username_if_desired",
            "PASSWORD": "password_if_needed",
            "DATABASE": "cache_db_name",  # in not supplied in URI
            "COLLECTION": "cache_collection",  # default: django_cache
            # Any Connection Options supported by pymongo
        },
        "TIMEOUT": 86400, # either set TIMEOUT or MAX_ENTRIES, not both
        "MAX_ENTRIES": 10000, # either set MAX_ENTRIES or TIMEOUT, not both
    }
}LOCATIONLocation supports MongoDBConnection String. Additionally, any supported pymongo parameters could beOPTIONSAny supportedpymongo parameterscould be added to OPTIONS.NoticeThe backend will handle TTL index creation if TIMEOUT is set, or will create a capped collection if MAX_ENTRIES is set. You should ensure that the collections are not created beforehands, so that the backend can do its work correctly.
Package: django-cache-zoom
Cache Machine provides automatic caching and invalidation for Django models
through the ORM.
Add full cache support for model sql functions.For django-cache-machine full docs, seehttps://cache-machine.readthedocs.org/en/latest/.RequirementsCache Machine requires Django 1.3+.  It was written and tested on Python 2.7.InstallationGet it frompypi:pip install django-cache-zoomRunning TestsGet it fromgithub:git clone git://github.com/lethe3000/django-cache-zoom.git
cd django-cache-zoom
pip install -r requirements.txt
fab test
Package: django-cadence
django_cadenceA reusable Django app that provides scheduling of asynchronous tasks (optionally as asynchronous tasks via Dramatiq or Celery)IntroductionThis is a simple package, so far at least, that provides some scheduling capabilities in Django.
It can do this standalone, or in cooperation withDramatiqorCelery.Links and ReferencesReleases - PyPIReleases - GitHubGitHub IssuesSourceChangeLogLicenseContributingWhat's NewCurrent version: 0.1.2Testing travis deployment, and updating documentation.See thechangelogfor more information on recent changes.Supported ReleasesSee [SECURITY.md] for releases which are currently supported for security updates.In general, the current major release is supported for all bug and security fixes, and the previous major release is supported for security fixes only.DependenciesRequired:Pythonv3.6.x - v3.8.xDjangov2.2.x - v3.0.xAPSchedulerv3.6.xRecommended:Dramatiqv1.8.x - v1.9.x
(or)Celeryv4.4.xInstallingUse pip or another pip-based tool in combination with PyPI to install this package.Getting SupportFirst, unless it is extremely urgent, please check the FAQ, Known Issues section, and general documentation before looking for help.There are a few avenues available for support. In general, if you're really confident you've found a bug, log an issue directly via GitHub.Log an issue via GitHubFAQThis section contains some frequent questions and answers, be aware that if you did not read this section and ask one of these questions on the forum or chat server, you might get redirected back to read this with varying levels of politeness or irritation. ;-)When will the mod be updated for Django version X, Python version Y, etc?When it is done. Pull requests are welcome.Known IssuesThis section attempts to sum up known issues in a easier-to-consume way. For the most up-to-date information on this, it might be worth checkingGitHub IssuesThere are currently no known issues.ContributingSee [CONTRIBUTING.md] for information on how you can help contribute to this project.Special ThanksHere is a non-exhaustive list of sources, people, etc that deserve some thanks for bringing this project into existence:
Package: django-cae
Classificação Portuguesa das Actividades EconómicasDocumentationThe full documentation is athttps://django-cae.readthedocs.io.QuickstartInstall CAE app:pip install django-caeAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'cae.apps.CaeConfig',...)Add CAE app’s URL patterns:fromcaeimporturlsascae_urlsurlpatterns=[...url(r'^',include(cae_urls)),...]FeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxDevelopment commandspip install -r requirements_dev.txt
invoke -lCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2021-05-04)First release on PyPI.