Index: /anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
===================================================================
--- /anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py	(revision 4277)
+++ /anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py	(revision 4278)
@@ -960,8 +960,8 @@
         domain.starttime = start
         F = file_function(filename + '.tms', domain,
-                          quantities = ['Attribute0', 'Attribute1', 'Attribute2'])
-        
-
-        #print F.T
+                          quantities = ['Attribute0', 'Attribute1', 'Attribute2'],
+                          use_cache=True)
+        
+
         #print F.precomputed_values
         #print 'F(60)', F(60)
Index: /anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
===================================================================
--- /anuga_core/source/anuga/abstract_2d_finite_volumes/util.py	(revision 4277)
+++ /anuga_core/source/anuga/abstract_2d_finite_volumes/util.py	(revision 4278)
@@ -70,24 +70,11 @@
               'interpolation_points': interpolation_points,
               'time_thinning': time_thinning,                   
-              'verbose': verbose}
-
-
-    # Call underlying engine with or without caching
-    if use_cache is True:
-        try:
-            from caching import cache
-        except:
-            msg = 'Caching was requested, but caching module'+\
-                  'could not be imported'
-            raise msg
-
-        f = cache(_file_function,
-                  args, kwargs,
-                  dependencies=[filename],
-                  compression=False,                  
-                  verbose=verbose)
-
-    else:
-        f = apply(_file_function,
+              'verbose': verbose,
+              'use_cache': use_cache
+              }
+
+    #caching moved to deeper within the function to avoid caching an
+    #instance of an object, which isn't generally good.
+    f = apply(_file_function,
                   args, kwargs)
 
@@ -105,6 +92,7 @@
                    quantities=None,
                    interpolation_points=None,
-                   time_thinning=1,                                                
-                   verbose=False):
+                   time_thinning=1, 
+                   verbose=False,
+                   use_cache=False):
     """Internal function
     
@@ -146,5 +134,6 @@
                                         interpolation_points,
                                         time_thinning=time_thinning,
-                                        verbose=verbose)
+                                        verbose=verbose,
+                                        use_cache=use_cache)
     else:
         raise 'Must be a NetCDF File'
@@ -157,5 +146,6 @@
                              interpolation_points=None,
                              time_thinning=1,                             
-                             verbose=False):
+                             verbose=False,
+                             use_cache=False):
     """Read time history of spatial data from NetCDF sww file and
     return a callable object f(t,x,y)
@@ -325,14 +315,26 @@
         vertex_coordinates = triangles = interpolation_points = None         
 
-
-    return Interpolation_function(time,
-                                  quantities,
-                                  quantity_names,
-                                  vertex_coordinates,
-                                  triangles,
-                                  interpolation_points,
-                                  time_thinning=time_thinning,
-                                  verbose=verbose)
-
+    
+ 
+    args = (time, quantities, quantity_names, vertex_coordinates, 
+            triangles, interpolation_points, )
+            
+    kwargs = {'time_thinning': time_thinning,
+              'verbose': verbose
+              }
+#    print'CACHING FROM UTIL.py for interpolation_function', use_cache
+    from anuga.caching import myhash
+    if use_cache is True:
+        from caching import cache
+        
+        interpolation_function = cache(Interpolation_function,
+                                       args, kwargs,
+                                       verbose=verbose,
+                                       compression=False)
+    else:
+        interpolation_function = apply(Interpolation_function,
+                                       args, kwargs)
+#    print 'myhash', myhash(interpolation_function) 
+    return interpolation_function 
 
 
