Bug 5549 : Format Date in ILSDI::Services to include hhmm
[koha_gimpoz] / C4 / SQLHelper.pm
index 900e40d..e1cb5d0 100644 (file)
@@ -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)