@@ -190,17 +190,17 @@ public Set<String> keySet(String value) {
190190 * @return null
191191 **/
192192 @ Override
193- public String setValueRaw (String key , String value , long expire ) {
193+ public String setValueRaw (String key , String value , long expireAt ) {
194194 // Configure this to be an "upsert" query
195195 FindOneAndUpdateOptions opt = new FindOneAndUpdateOptions ();
196196 opt .upsert (true );
197197
198198 // Generate the document of changes
199199 // See: https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/
200-
200+
201201 // Generate the "update" doc
202202 Document updateDoc = new Document ();
203- Document set_doc = new Document ();
203+ Document set_doc = new Document ();
204204
205205 // Expire timestamp if its configured, else it should be removed
206206 if (expireAt > 0 ) {
@@ -211,9 +211,9 @@ public String setValueRaw(String key, String value, long expire) {
211211 updateDoc .append ("$unset" , unset_doc );
212212 }
213213
214- // Setup the value on update/insert/upsert
214+ // Setup the value on update/insert/upsert
215215 set_doc .append ("val" , value );
216- updateDoc .append ("$set" , set_doc );
216+ updateDoc .append ("$set" , set_doc );
217217
218218 // Set the key on insert
219219 Document setOnInsert_doc = new Document ();
@@ -248,14 +248,14 @@ public MutablePair<String, Long> getValueExpiryRaw(String key, long now) {
248248
249249 // Lets get all the key values
250250 String val = GenericConvert .toString (resObj .get ("val" ), null );
251- Date expireAt_date = resObj .get ("expireAt" );
252- long expireAt_long = 0 ;
251+ Date expireAt_date = resObj .getDate ("expireAt" );
252+ long expireAt_long = 0 ;
253+
254+ // Check if expireAt date is set
255+ if (expireAt_date != null ) {
256+ expireAt_long = expireAt_date .getTime ();
257+ }
253258
254- // Check if expireAt date is set
255- if ( expireAt_date != null ) {
256- expireAt_long = expireAt_date .getTime ();
257- }
258-
259259 // Check for null objects
260260 if (val == null || val .isEmpty ()) {
261261 return null ;
0 commit comments