File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ int MiniKVDB::setExpire(std::string key, uint64_t expires) {
5959}
6060
6161void MiniKVDB::rdbSave () {
62+ // TODO: save the expire time
6263 std::unique_lock<std::shared_mutex> lk (smutex_);
6364 kvlogi (" rdb save triggered!" );
6465 io_->clearFile ();
@@ -187,11 +188,11 @@ void MiniKVDB::rdbLoadEntry() {
187188}
188189
189190void MiniKVDB::rdbFileReadInitDB () {
190- if (io_->emptyFile ()) {
191+ if (io_->empty ()) {
191192 kvlogi (" No rdb file to load." );
192193 return ;
193194 }
194- while (!io_->reachEOF ()) {
195+ while (!io_->empty ()) {
195196 rdbLoadEntry ();
196197 }
197198 kvlogi (" Rdb file loaded." );
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ typedef class MiniKVDB {
4848 void rdbFileReadInitDB ();
4949 void rdbLoadEntry ();
5050 void rdbSave ();
51+ // void fixedTimeDeleteExpiredKey();
5152public:
5253 void insert (std::string key, std::string val, uint32_t encoding);
5354 void get (std::string key, std::vector<std::string>& res);
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class KVio {
3333 bool reachEOF () {
3434 return feof (fp_);
3535 }
36- bool emptyFile () {
36+ bool empty () {
3737 if (!fp_) return true ;
3838 getc (fp_);
3939 if (feof (fp_)) {
You can’t perform that action at this time.
0 commit comments