DJANGOLEARN_IR Telegram 1133
چرا در محیط پروداکشن نباید از سیستم cache پیشفرض جنگو استفاده کنیم؟

جواب:
چون برای پروداکشن مناسب نیست، برای development مناسبه.

چون آقای داکیومنت جنگو میگه:
Note that each process will have its own private cache instance, which means no cross-process caching is possible. This also means the local memory cache isn’t particularly memory-efficient, so it’s probably not a good choice for production environments. It’s nice for development.

راحت تر بگم:

به صورت پیشفرض، اگه backend برای cache تعریف نکنیم، خودش روی LocMemCache تنظیم شده.
و اگه مثلا اینجوری چیزی رو کش کنیم:
cache.set("my_key", "hello, world!", 30)

روی لوکال و با runserver اوکیه همه چی😎

اما اگه پروژه رو ببریم روی سرور و مثلا از nginx و gunicorn استفاده کنیم، چون معمولا چندین worker process ساخته میشه
و هر process کش خودش رو داره، پس ممکنه دستور ع:
cache.get("my_key")

به دنیا سلام نکنه 😢

پس چکار میکنن؟
از بکندهای دیگه برای کش استفاده میشه، اینا بکندهای دیگه هستن
FileBasedCache
DatabaseCache
PyMemcacheCache
RedisCache

توصیه: برای هر پروژه ای، لازم نیست حتما بری سراغ ردیس. دیتابیس کش هم برای پروژه هایی که بزرگ نیستن خوبه.

میدونستی؟ 🥱 بزار
این پست اسپانسر نداره، شما 🫵🏼 می تونید اسپانسرش بشید 😈
👍32107🆒3🔥2🥱2



tgoop.com/djangolearn_ir/1133
Create:
Last Update:

چرا در محیط پروداکشن نباید از سیستم cache پیشفرض جنگو استفاده کنیم؟

جواب:
چون برای پروداکشن مناسب نیست، برای development مناسبه.

چون آقای داکیومنت جنگو میگه:
Note that each process will have its own private cache instance, which means no cross-process caching is possible. This also means the local memory cache isn’t particularly memory-efficient, so it’s probably not a good choice for production environments. It’s nice for development.

راحت تر بگم:

به صورت پیشفرض، اگه backend برای cache تعریف نکنیم، خودش روی LocMemCache تنظیم شده.
و اگه مثلا اینجوری چیزی رو کش کنیم:

cache.set("my_key", "hello, world!", 30)

روی لوکال و با runserver اوکیه همه چی😎

اما اگه پروژه رو ببریم روی سرور و مثلا از nginx و gunicorn استفاده کنیم، چون معمولا چندین worker process ساخته میشه
و هر process کش خودش رو داره، پس ممکنه دستور ع:
cache.get("my_key")

به دنیا سلام نکنه 😢

پس چکار میکنن؟
از بکندهای دیگه برای کش استفاده میشه، اینا بکندهای دیگه هستن
FileBasedCache
DatabaseCache
PyMemcacheCache
RedisCache

توصیه: برای هر پروژه ای، لازم نیست حتما بری سراغ ردیس. دیتابیس کش هم برای پروژه هایی که بزرگ نیستن خوبه.

میدونستی؟ 🥱 بزار
این پست اسپانسر نداره، شما 🫵🏼 می تونید اسپانسرش بشید 😈

BY جنگولرن


Share with your friend now:
tgoop.com/djangolearn_ir/1133

View MORE
Open in Telegram


Telegram News

Date: |

The administrator of a telegram group, "Suck Channel," was sentenced to six years and six months in prison for seven counts of incitement yesterday. The best encrypted messaging apps The channel also called on people to turn out for illegal assemblies and listed the things that participants should bring along with them, showing prior planning was in the works for riots. The messages also incited people to hurl toxic gas bombs at police and MTR stations, he added. Write your hashtags in the language of your target audience. According to media reports, the privacy watchdog was considering “blacklisting” some online platforms that have repeatedly posted doxxing information, with sources saying most messages were shared on Telegram.
from us


Telegram جنگولرن
FROM American