Browse files

adding reload_database method to config class to clear the current da…

…tabase from memory
  • Loading branch information...
1 parent de23cc9 commit b2afadb61cf1c2732906cf1724f15834b2382d14 @ryanb committed Jun 15, 2009
Showing with 10 additions and 2 deletions.
  1. +2 −0 CHANGELOG
  2. +2 −2 README.rdoc
  3. +6 −0 lib/xapit/config.rb
View
2 CHANGELOG
@@ -1,3 +1,5 @@
+* adding Xapit::Config#reload_database method
+
*0.2.1* (June 15th, 2009)
* including Xapit::Membership into ActiveRecord when using gem
View
4 README.rdoc
@@ -77,8 +77,8 @@ You may want to trigger this via a cron job on a recurring schedule (i.e. every
There are two projects in development to help improve this reindexing.
-http://github.com/ryanb/xapit-sync/tree/master
-http://github.com/ryanb/xapit-server/tree/master
+* http://github.com/ryanb/xapit-sync/tree/master
+* http://github.com/ryanb/xapit-server/tree/master
== Search
View
6 lib/xapit/config.rb
@@ -67,6 +67,12 @@ def writable_database
# Removes the configured database file and clears the stored one in memory.
def remove_database # this can be a bit dangers, maybe do some checking here first?
FileUtils.rm_rf(path) if File.exist? path
+ reload_database
+ end
+
+ # Clear the current database from memory to fetch it again (upon request).
+ # Note: It is best to only use this on a readable database.
+ def reload_database
@database = nil
@writable_database = nil
end

0 comments on commit b2afadb

Please sign in to comment.