GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Data::Remember::Hybrid(3) User Contributed Perl Documentation Data::Remember::Hybrid(3)

Data::Remember::Hybrid - a brain for Data::Remember with multiple personalities

version 0.140490

  use Data::Remember Hybrid =>
      [ ]                   => [ 'Memory' ],
      'config'              => [ YAML => file => 'config.yml' ],
      [ data => 'persist' ] => [ DBM  => file => 'state.db'   ],
      [ data => 'temp'    ] => [ 'Memory' ],
      ;

  my $config_opt = recall [ config => 'SomeOption' ];

  remember [ data => persist => 'something' ] => 'what?';
  remember [ data => temp    => 'forgetful' ] => 'huh?';

  remember anything_else => 'blah';

Sometimes (or frequently, in my case) you really need easy access to different kinds of storage in one brain. This is what the hybrid brain does. You can basically specify that any key and all subkeys are handled by a specific brain.

Arguments to the hybrid brain are basically an alternating set of ques and brain configurations. You must always at least specify the special que "[]", which refers to the root brain.

The TABLE argument is required. It contains a list of brains to configure with the hybrid brain. The table alternates between ques and brain configurations. The special que "[]" must be given to specify which brain configuration will be used when no other key set matches (the root brain).

Each pair is setup so that any que specified for "remember", "forget", or "recall" will be evaluated against the list of ques in the mount table. The longest que in the mount table matching a prefix of the que specified will be picked. If no que prefix matches, then the fallback "[]" will be used.

The ques may be given in any way that Data::Remember would accept them.

The configurations are given wrapped in "[]", but should be exactly the same otherwise.

This allows you to add additional sub-brains to the hybrid brain after it has been initialized. If you reuse a que that has already been registered using this method or during initialization, that brain will be completely replaced.

If you want to remove a brain you will want to see "unregister_brain".

Removes a brain configuration from the given QUE. This method returns true if a configuration was actually unregistered or false otherwise.

Returns a sub-brain that would serve the given "QUE".

Stores the given FACT in the appropriate brain according to QUE.

Recalls the fact stored at QUE in one of the hybrid's brains.

Forgets the fact stored at QUE in one of the hybrid's brains.

Data::Remember

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

This software is copyright (c) 2014 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2014-02-18 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.