Subject: | overrideability of store_multi somewhat less than ideal |
As per: https://metacpan.org/pod/CHI::Driver::Development#store_multi-key_data-options , it seems this method is easy and safe to simply override.
However, unlike all the other methods that are listed to be overridden, this method gets passed the keys *untransformed*, which will mean keys set with it will not be read by subsequent fetchers, unless the implementor manually calls ->transform_key for each of them.
Additionally, implementors will discover they also have to check the validity of the data they get passed themselves, as the test suite expects a croak:
ok 724 - get_multi_hashref throws error when no key passed
not ok 725 - set_multi throws error when no key passed
# Failed test 'set_multi throws error when no key passed'
# at /home/kent/perl5/perlbrew/perls/blead/lib/site_perl/5.21.3/CHI/t/Driver.pm line 1738.
# (in CHI::Driver::LMDB::t::CHIDriverTests->test_missing_params)
# expecting: Regexp ((?^:must specify key))
# found: normal exit
ok 726 - remove_multi throws error when no key passed
Additionally, because that method relies on the method "set" , not store, there's a very substantial amount of effort required to implement this method
https://metacpan.org/source/HAARG/CHI-0.58/lib/CHI/Driver.pm#L381
For example, I'm implementing such a thing where the write happens in a full transaction, I *cant* call set() after spawning a transaction, because that will simply call ->store(), which already creates a transaction, and the result is 2 transactions, and the point of overriding this method is completely negated.
In essence, as it stands, attempting to implement this method to be in any way useful requries implementing code replicating a sizable amount of CHI ( unless I'm missing something ).