Skip to content

Instantly share code, notes, and snippets.

@dmitry-udod
Last active February 13, 2023 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry-udod/a6f391a7cda72f80fcef9f6e14d81a41 to your computer and use it in GitHub Desktop.
Save dmitry-udod/a6f391a7cda72f80fcef9f6e14d81a41 to your computer and use it in GitHub Desktop.
Cache TTL with time jitter
$ttl = (int) (3600 + (mt_rand() / mt_getrandmax() * (60 * 2))); /* +/- 2 minutes */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment