seitime-frappe/frappe/utils
Ankush Menat 111df3a8d7 perf: improve document caching
As per current implementation whenever `get_doc` is called, document is
cached. However, this cache is only ever used by `get_cached_doc`. Going
through the codebase of both FF/ERPNext you'll find that `get_doc` is
used a lot more than `get_cached_doc`. So in many places, all this
caching overhead is unnecessary.

This change removes implicit caching from get_doc and replaces it with
cache-replacement instead. i.e. cache is only updated if it exists but
not created from get_doc.

Pros:
- faster `get_doc`
- lower memory usage on Redis
- Reduces chances of OOM by blowing up worker's memory as old docs can't
  be GCed until
- Correctness i.e. caching only what gets used from cache.

Con:
- After this change. First call to `get_cached_doc` will always be a cache miss. DUH.
2022-06-06 16:18:23 +05:30
..
__init__.py Merge pull request #15538 from noahjacob/phone_field_control 2022-04-28 10:27:52 +05:30
background_jobs.py refactor: Fix flake8 issues 2022-05-19 15:34:35 +05:30
backups.py refactor: Fix flake8 issues 2022-05-19 15:34:35 +05:30
bench_helper.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
boilerplate.py chore!: remove dead hooks app_icon & app_color 2022-05-10 14:41:01 +05:30
change_log.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
commands.py feat(wip): Custom filters in db.query engine 2022-05-19 17:31:35 +05:30
connections.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
csvutils.py refactor: Remove dead code (#16886) 2022-05-12 18:04:44 +05:30
dashboard.py refactor: Remove unused imports & code 2022-05-19 15:34:35 +05:30
data.py fix: Strip all spacing characters from Message-ID & In-Reply-To (#16999) 2022-05-27 21:06:07 +05:30
dateutils.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
diff.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
doctor.py refactor: Remove unused imports & code 2022-05-19 15:34:35 +05:30
error.py refactor: Fix flake8 issues 2022-05-19 15:34:35 +05:30
file_lock.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
file_manager.py refactor: Remove unused imports & code 2022-05-19 15:34:35 +05:30
fixtures.py refactor: Sync fixtures 2022-04-26 23:43:07 +02:00
formatters.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
global_search.py refactor: Fix flake8 issues 2022-05-19 15:34:35 +05:30
goal.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
html_utils.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
identicon.py chore: Update typing + noqa - flake8 failures 2022-05-23 18:55:55 +05:30
image.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
install.py fix: only set home_page in after_install, if the key doesn't have value 2022-05-11 16:18:14 +05:30
jinja.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
jinja_globals.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
lazy_loader.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
logger.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
make_random.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
momentjs.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
nestedset.py refactor: Re-write queries using SubQuery 2022-05-27 17:32:37 +05:30
oauth.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
password.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
password_strength.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
pdf.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
print_format.py refactor: Remove unnecessary exception handling 2022-06-01 17:50:07 +05:30
redis_queue.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
redis_wrapper.py perf: improve document caching 2022-06-06 16:18:23 +05:30
response.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
safe_exec.py fix: Passing dev server variable to jenv globals correctly (#16843) 2022-05-18 09:19:24 +00:00
scheduler.py fix: Show site name along with debugging messages 2022-05-10 13:33:53 +05:30
testutils.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
user.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
verified_command.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
weasyprint.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
xlsxutils.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30