Cache::FileCache(3pm)

πŸ’– Cache::FileCache πŸ’–

okay bestie, welcome to Cache::FileCache(3pm) β€” yes that's the section 3pm perl manpage, and yes we're gonna have a time ✨


🌸 NAME 🌸

Cache::FileCache β€” the class that implements the Cache interface. that's it, that's the whole name section, she's short and she knows it πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so. the FileCache class implements the Cache interface. the way it works is it stores your data in the filesystem, which means β€” and this is the slay part β€” it can be shared between processes πŸ”₯

like, multiple processes, same cache, no drama. iconic behaviour honestly.


✨ SYNOPSIS ✨

here's the vibe, copy-paste core:

use Cache::FileCache;

my $cache = new Cache::FileCache( { 'namespace' => 'MyNamespace',
                                    'default_expires_in' => 600 } );

and for the full usage synopsis, go look at Cache::Cache β€” she's got the whole thing 🫢


πŸŽ€ METHODS πŸŽ€

the API documentation lives in Cache::Cache, bestie. but here's what FileCache brings to the function list:

  • Clear( [$cache_root] ) β€” check Cache::Cache, except this one takes the optional $cache_root parameter 🧹
  • Purge( [$cache_root] ) β€” check Cache::Cache, again with the optional $cache_root parameter πŸŒͺ️
  • Size( [$cache_root] ) β€” check Cache::Cache, and yep, optional $cache_root parameter πŸ“

πŸ’… OPTIONS πŸ’…

standard options? those live in Cache::Cache, go say hi πŸ‘‹. additionally, you set these options by passing in a reference to a hash containing any of the following keys:

  • cache_root β€” where in the filesystem the root of the cache lives. defaults to 'FileCache' under the OS default temp directory (which is often '/tmp' on UNIXes, iykyk) β€” unless you explicitly set it πŸ“
  • cache_depth β€” how many subdirectories deep to cache object item. lowkey important: this should be large enough that no cache directory has more than a few hundred objects. defaults to 3 unless explicitly set πŸ—‚οΈ
  • directory_umask β€” the directories in the cache on the filesystem should be globally writable to allow for multiple users. and yeah, that's a potential security concern, no cap β€” but the actual cache entries are written with the user's umask, which reduces the risk of cache poisoning. if you want it to be user-writable only, set the 'directory_umask' option to '077' or something like that. defaults to '000' unless explicitly set πŸ”

πŸ‘‘ PROPERTIES πŸ‘‘

default properties? Cache::Cache has them, go read her πŸ’œ

  • (get|set)_cache_root β€” see the definition above for the option cache_root
  • (get|set)_cache_depth β€” see the definition above for the option cache_depth
  • (get|set)_directory_umask β€” see the definition above for the option directory_umask

🌈 SEE ALSO 🌈

  • Cache::Cache β€” the main character, the blueprint, the moment πŸ’«

πŸ“ AUTHOR πŸ“

  • Original author: DeWitt Clinton <dewitt@unto.net>
  • Last author: $Author: dclinton $
  • Copyright (C) 2001-2003 DeWitt Clinton

fr fr that's the whole page, nothing skipped, nothing invented. every option, every default, every '077' and '000' accounted for πŸ’―

and that's a wrap, bestie 🫢 this was perl v5.34.0, dated 2022-06-30, and it's the Cache::FileCache(3pm) manpage β€” periodt πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from