X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FSQLHelper.pm;h=e1cb5d0a9aa35e8787d95e867c69077184d2a87f;hb=9ffd92948b99b8440d9682c8b28e6be76e55a166;hp=900e40dba54180fdc0536f2b97d317d0424ecfcc;hpb=6c38cc23d95b63ae069f7cac2f7d8d97f9c941ae;p=koha_gimpoz diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm index 900e40dba5..e1cb5d0a9a 100644 --- a/C4/SQLHelper.pm +++ b/C4/SQLHelper.pm @@ -34,12 +34,13 @@ eval { import Memoize::Memcached qw(memoize_memcached); my $memcached = { - servers => [$servers], - key_prefix => C4::Context->config('memcached_namespace') || 'koha', - }; + servers => [$servers], + key_prefix => C4::Context->config('memcached_namespace') || 'koha', + expire_time => 600 + }; # cache for 10 mins - memoize_memcached( '_get_columns', memcached => $memcached, expire_time => 600000 ); #cache for 10 minutes - memoize_memcached( 'GetPrimaryKeys', memcached => $memcached, expire_time => 600000 ); #cache for 10 minutes + memoize_memcached( '_get_columns', memcached => $memcached ); + memoize_memcached( 'GetPrimaryKeys', memcached => $memcached ); } }; @@ -54,6 +55,7 @@ BEGIN { SearchInTable UpdateInTable GetPrimaryKeys + clear_columns_cache ); %EXPORT_TAGS = ( all =>[qw( InsertInTable DeleteInTable SearchInTable UpdateInTable GetPrimaryKeys)] ); @@ -252,6 +254,23 @@ sub GetPrimaryKeys($) { return grep { $hash_columns->{$_}->{'Key'} =~/PRI/i} keys %$hash_columns; } + +=head2 clear_columns_cache + + C4::SQLHelper->clear_columns_cache(); + +cleans the internal cache of sysprefs. Please call this method if +you update a tables structure. Otherwise, your new changes +will not be seen by this process. + +=cut + +sub clear_columns_cache { + %$hashref = (); +} + + + =head2 _get_columns _get_columns($tablename)