Project

General

Profile

« Previous | Next » 

Revision 3343

Added by Jing Tao almost 17 years ago

Add code to expire cached query result when metacat have a insert, update or delete action.

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
2465 2465
        // metacat notify the force replication.
2466 2466
        ForceReplicationHandler frh = new ForceReplicationHandler(accnum,
2467 2467
                action, true, null);
2468
        // clear cache after inserting or updating a document
2469
        if (MetaCatUtil.getOption("query_cache_on").equals("true"))
2470
        {
2471
          //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
2472
     	   DBQuery.clearQueryResultCache();
2473
        }
2468 2474

  
2469 2475
        logMetacat.info("Conn Usage count after writting: "
2470 2476
                + conn.getUsageCount());
......
2638 2644
                    + "rule for package: " + accnum + " because "
2639 2645
                    + ee.getMessage());
2640 2646
        }
2647
      
2641 2648
        //Force replication to other server
2642 2649
        if (!timedReplication)
2643 2650
        {
2644 2651
          ForceReplicationHandler forceReplication = new ForceReplicationHandler(
2645 2652
                accnum, action, true, notifyServer);
2646 2653
        }
2654
        
2655
        // clear cache after inserting or updating a document
2656
        if (MetaCatUtil.getOption("query_cache_on").equals("true"))
2657
        {
2658
          //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
2659
     	   DBQuery.clearQueryResultCache();
2660
        }
2661
    
2647 2662
        return (accnum);
2648 2663
    }
2649 2664

  
......
2926 2941

  
2927 2942
            conn.commit();
2928 2943
            conn.setAutoCommit(true);
2944
        
2945
            // add force delete replcation document here.
2946
            ForceReplicationHandler frh = new ForceReplicationHandler(
2947
                             accnum, ForceReplicationHandler.DELETE, isXML, notifyServer);
2948
            // clear cache after inserting or updating a document
2949
            if (MetaCatUtil.getOption("query_cache_on").equals("true"))
2950
            {
2951
              //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
2952
         	   DBQuery.clearQueryResultCache();
2953
            }
2954
          
2929 2955

  
2930 2956
        } catch (Exception e) {
2931 2957
            logMetacat.error("error in DocumentImpl.delete: "
......
2944 2970
                DBConnectionPool.returnDBConnection(conn, serialNumber);
2945 2971
            }
2946 2972
        }
2947
       // add force delete replcation document here.
2948
       ForceReplicationHandler frh = new ForceReplicationHandler(
2949
                        accnum, ForceReplicationHandler.DELETE, isXML, notifyServer);
2973
       
2950 2974

  
2951 2975
    }
2952 2976

  

Also available in: Unified diff