Cache Management| In Django project

Cache management:-

So here we will talk about Cache management , it can be also done by (cache management magento,cache management in obiee,cache management in hibernate,cache management in spring boot,cache management in obiee 12c,cache management in os,cache management in magento 2,cache management asp.net,cache management angular,cache management in power bi)

 Generally if we perform any operation in the browser then Django will do lot of calculation on the server and then it returns the result on the browser
if we do same operation on the same machine then django will do all operations again that means
if we perform same operation ten times on the same machine then django will perform all calculations ten times which will become overhead or burden on the server 



to reduce overhead or burden we use cache management  
cache files stores the dynamic web page after performing the operation for first time.
if we search anything in a browser then django will go to server as a request and it does all calculations 
and at response time django will store the dynamic webpage the cache file and then it will return to the browser 
if we perform the same operation then it will go to cache file and fetch the existing dynamic webpages  
if we perform a different operation then django will to server
and it takes new cache file to store the dynamic webpage and returns to the browser

we can save the cache file in different locations .

  •  memcached
  •  locmem
  •  filebased
  •  db

we do settings in settings.py file to configure cache file
_________________________________________
memcached—>
 If we want to store the cache file in a any other servers then we can configure memcached in settings.py file 

CACHES={
‘default’:{
‘BACKEND’:’django.core.cache.backends.memcached.MemcachedCache’,
‘LOCTION’:’127.0.0.1:8001′
}
}
BACKEND–it is a python dotted path to the corresponding engine
_____________________________________________

Locmem—if we want to store the cache file in local server then we use locmem

CACHES={
‘default’:{
‘BACKEND’:’django.core.cache.backends.locmem.LocMemCache’,
‘LOCTION’:’127.0.0.1:8000′
}
}

___________________________-

filebased:-
 if we want to store the cache file in any specific directory in our machine then we specify the path 

CACHES={
‘default’:{
‘BACKEND’:’django.core.cache.backends.filebased.FileBasedCache’,
‘LOCTION’:’d:Folder1′
}
}
______________________________________

db
if we want to store in any database table then we create the cache table and then we specify the table name.
command for creating cache table
  
python manage.py createcachetable mytab

CACHES={
‘default’:{
‘BACKEND’:’django.core.cache.backends.db.BaseDatabaseCache’,
‘LOCTION’:’mytab’
}
}

_______________________________________

so i hope you under stand Django(Python) cache concept.

Leave a Reply

Your email address will not be published. Required fields are marked *