Cache:...ackend(3pm)

πŸ’– Cache::FileBackend β€” the filesystem one, bestie πŸ’–

okay so this is a page from the User Contributed Perl Documentation manual, and the page itself is called Cache:...ackend(3pm) (yes the title is literally truncated like that, we love a mysterious queen πŸ’…). Anyway. Sit down, grab a strawberry πŸ“, because we're talking about persistence that lives on your actual disk.


✨ NAME ✨

Cache::FileBackend β€” it's a filesystem based persistence mechanism. That's it, that's the whole vibe. Your data goes to the filesystem and stays there. No cap. πŸ’Ύβœ¨


🌸 DESCRIPTION 🌸

The FileBackend class is used to persist data to the filesystem. Like, that's its whole job. It takes stuff, it writes it down on disk, and it does not forget. Main character energy fr fr. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole thing verbatim, because code is sacred and we do not paraphrase code in this house:

  my $backend = new Cache::FileBackend( '/tmp/FileCache', 3, 000 );

  See Cache::Backend for the usage synopsis.

  $backend->store( 'namespace', 'foo', 'bar' );

  my $bar = $backend->restore( 'namespace', 'foo' );

  my $size_of_bar = $backend->get_size( 'namespace', 'foo' );

  foreach my $key ( $backend->get_keys( 'namespace' ) )
  {
    $backend->delete_key( 'namespace', $key );
  }

  foreach my $namespace ( $backend->get_namespaces( ) )
  {
    $backend->delete_namespace( $namespace );
  }

look at her go πŸ₯Ή storing, restoring, getting sizes, yeeting keys, yeeting whole namespaces. iconic behaviour only.


πŸŽ€ METHODS πŸŽ€

See Cache::Backend for the API documentation. β€” that's where the full API lore lives, go read it, iykyk.

  • new( $root, $depth, $directory_umask ) β€” Constructs a brand new FileBackend. It writes data into the $root directory, automatically makes subdirectories $depth levels deep (yes, automatically, she's self-sufficient πŸ’…), and uses the umask of $directory_umask when it's creating those directories.

🌈 PROPERTIES 🌈

  • (get|set)_root β€” the location of the parent directory where the files actually get stored. home base. 🏠
  • (get|set)_depth β€” the branching factor of the subdirectories that get created to hold the files. it's giving tree structure. 🌳
  • (get|set)_directory_umask β€” the umask to be used when creating directories. permissions, but make it fashion. πŸ”

πŸ”₯ SEE ALSO πŸ”₯

go check out the rest of the squad:

  • Cache::Backend
  • Cache::MemoryBackend
  • Cache::SharedMemoryBackend

πŸ‘‘ AUTHOR πŸ‘‘

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

and that's the whole page, bestie!! 🫢 this one came from perl v5.34.0 and it's dated 2022-06-30, and yeah the footer still calls it Cache:...ackend(3pm) because some things never change πŸ’€ stay hydrated, back up your data, mwah πŸ’–

πŸ“¦ where this page comes from