public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH fb v1 0/6] Introducing cache for the Facebook scraper
@ 2023-05-09 10:46 Ammar Faizi
  2023-05-09 10:46 ` [PATCH fb v1 1/6] fb: Introduce `getCache()` and `setCache()` functions Ammar Faizi
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Ammar Faizi @ 2023-05-09 10:46 UTC (permalink / raw)
  To: GNU/Weeb FB Team
  Cc: Ammar Faizi, GNU/Weeb Mailing List, Michael William Jonathan

Hi,

This series introduce a cache mechanism to speed up the web API
performance. It's very useful to reduce the pain when developing an
app that uses the API. It also greatly reduces the number of requests
to the same endpoint that happens in a short period of time.

There are 6 patches in this series:

Patch #1: Introduce `getCache()` and `setCache()`.
A preparation patch to implement better caching mechanism. All methods
that need cache will call these functions.

Patch #2: Replace old cache mechanism in `getTimelineYears()`.
Simplify the caching mechanism and make the `getTimelineYears()`
cache private to itself. This also means that the endpoint
"action=getTimelineYears" will utilize the cache.

Patch #3, #4: Implement cache in `getTimelinePosts()` and `getPost()`.
Make short repeated calls fast.

Patch #5: Introduce `clearExpiredCaches()`.
When a cache is expired, it won't be deleted unless getCache() with the
corresponding key is invoked. Introduce a new function to scan for
expired caches and delete them.

Patch #6: Create cron.php to clear cache.
Allow the server to clear expired caches via a small PHP script,
cron.php. Periodically calling clearExpiredCaches() will delete old
expired caches, it saves storage space.

Signed-off-by: Ammar Faizi <[email protected]>
---

The following changes since commit 0d5e59e00359e165778a81f80122bb522f8edb0f:

  Merge branch 'rewrite_url' (Facebook Onion rewrite support) (2023-05-03 18:46:47 +0700)

are available in the Git repository at:

  https://gitlab.torproject.org/ammarfaizi2/Facebook.git dev.cache

for you to fetch changes up to d30f2dad8ca761b5a9c8de32ea48adbbdd201d03:

  fb: web: Create cron.php to clear cache (2023-05-09 17:33:12 +0700)

----------------------------------------------------------------
Ammar Faizi (6):
      fb: Introduce `getCache()` and `setCache()` functions
      fb: Post: Replace old cache mechanism in `getTimelineYears()`
      fb: Post: Implement cache in `getPost()`
      fb: Post: Implement cache in `getTimelinePosts()`
      fb: cache: Introduce `clearExpiredCaches()`
      fb: web: Create cron.php to clear cache

 src/Facebook/Facebook.php     | 99 ++++++++++++++++++++++++++++++----------
 src/Facebook/Methods/Post.php | 74 ++++++++++--------------------
 web/cron.php                  |  9 ++++
 3 files changed, 108 insertions(+), 74 deletions(-)
 create mode 100644 web/cron.php

base-commit: 0d5e59e00359e165778a81f80122bb522f8edb0f
-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-09 11:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 10:46 [PATCH fb v1 0/6] Introducing cache for the Facebook scraper Ammar Faizi
2023-05-09 10:46 ` [PATCH fb v1 1/6] fb: Introduce `getCache()` and `setCache()` functions Ammar Faizi
2023-05-09 10:46 ` [PATCH fb v1 2/6] fb: Post: Replace old cache mechanism in `getTimelineYears()` Ammar Faizi
2023-05-09 10:46 ` [PATCH fb v1 3/6] fb: Post: Implement cache in `getPost()` Ammar Faizi
2023-05-09 10:46 ` [PATCH fb v1 4/6] fb: Post: Implement cache in `getTimelinePosts()` Ammar Faizi
2023-05-09 10:46 ` [PATCH fb v1 5/6] fb: cache: Introduce `clearExpiredCaches()` Ammar Faizi
2023-05-09 10:46 ` [PATCH fb v1 6/6] fb: web: Create cron.php to clear cache Ammar Faizi
2023-05-09 11:06 ` [PATCH fb v1 0/6] Introducing cache for the Facebook scraper GNU/Weeb Facebook Team

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox