Cache:...taData(3pm)

πŸ’– NAME πŸ’–

Cache::CacheMetaData β€” literally all the tea about what's chillin' in your cache πŸ«–βœ¨


🌸 DESCRIPTION 🌸

okay so bestie, picture this: size aware caches need someone keeping receipts on the state of the cache, right? That's exactly what the CacheMetaData object does. It's the friend who remembers everything so you don't have to β€” it can hand you info like an object's size, or a whole ordered list of identifiers that need to get yeeted when a cache size is being limited. πŸ‘‘

ngl though, if you're just an end user, you will not normally use CacheMetaData directly. It's giving behind-the-scenes main character. The caches handle it. You just vibe. πŸ’…


✨ SYNOPSIS ✨

use Cache::CacheMetaData;

my $cache_meta_data = new Cache::CacheMetaData( );

foreach my $key ( $cache->get_keys( ) )
{
   my $object = $cache->get_object( $key ) or
     next;

   $cache_meta_data->insert( $object );
 }

my $current_size = $cache_meta_data->get_cache_size( );

my @removal_list = $cache_meta_data->build_removal_list( );

like... look at her go πŸ¦‹


πŸŽ€ METHODS πŸŽ€

  • new( ) β€” construct a brand new Cache::CacheMetaData object. fresh out the box, no notes. ✨
  • insert( $object ) β€” slide the CacheMetaData the info it needs about $object, the object sitting in the cache. keep her in the loop bestie. 🫢
  • remove( $key ) β€” tell the CacheMetaData that the object specified by $key is no longer in the cache. gone, bye, she's not coming back. πŸ‘‹
  • build_removal_list( ) β€” build a list of the keys in the cache, ordered like this:
    1. objects that expire now πŸ’€
    2. objects expiring at a particular time, with ties broken by the time at which they were least recently accessed
    3. objects that never expire, sub ordered by the time at which they were least recently accessed
NOTE: this could be improved further by taking the size into account on accessed_at ties. However, this type of tie is unlikely in normal usage. so basically it's a "sure bestie, noted, but it's not gonna come up" situation πŸ™ˆ
  • build_object_size( $key ) β€” return the size of an object specified by $key. boom, measurements. πŸ“

🌈 PROPERTIES 🌈

  • get_cache_size β€” the total size of the objects in the cache. the whole squad combined. ⭐

πŸ‘‘ SEE ALSO πŸ‘‘

Cache::Cache, Cache::CacheSizer, Cache::SizeAwareCache


πŸ’œ 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 little legend came to you courtesy of perl v5.34.0, dated 2022-06-30 β€” no cap, that's the version and the date right there in the footer, and yes it's iconic, periodt. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from