The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-oembed/server/models/OEmbedCache.js

38 lines
576 B

RocketChat.models.OEmbedCache = new class extends RocketChat.models._Base {
constructor() {
super('oembed_cache');
this.tryEnsureIndex({ 'updatedAt': 1 });
}
//FIND ONE
findOneById(_id, options) {
const query = {
_id
};
return this.findOne(query, options);
}
//INSERT
createWithIdAndData(_id, data) {
const record = {
_id,
data,
updatedAt: new Date
};
record._id = this.insert(record);
return record;
}
//REMOVE
removeAfterDate(date) {
const query = {
updatedAt: {
$lte: date
}
};
return this.remove(query);
}
};