-
Notifications
You must be signed in to change notification settings - Fork 3
opendkim.flush_cache()
Christopher Mooney edited this page Feb 12, 2018
·
4 revisions
Flush cached entries when caching is enabled in the library. opendkim.flush_cache()
can be called at any time.
For more information:
http://www.opendkim.org/libopendkim/dkim_flush_cache.html
Type: undefined
-
undefined
if caching is not active for this library instance. - Number of records flushed if caching is active.
- Caching is selected by setting the
DKIM_LIBFLAGS_CACHE
flag using theopendkim.options()
method. - Caching requires a special compile-time option to
libopendkim
since it also adds a library dependency to applications.
const OpenDKIM = require('node-opendkim');
async function foo() {
try {
var opendkim = new OpenDKIM();
var records = await opendkim.flush_cache();
if (records) {
console.log('flushed ' + records + ' records');
} else {
console.log('cache is off');
}
} catch (err) {
console.log(err);
}
}
const OpenDKIM = require('node-opendkim');
function foo_sync() {
try {
var opendkim = new OpenDKIM();
var records = opendkim.flush_cache_sync();
if (records) {
console.log('flushed ' + records + ' records');
} else {
console.log('cache is off');
}
} catch (err) {
console.log(err);
}
}
const OpenDKIM = require('node-opendkim');
function flush_cache(callback) {
var opendkim = new OpenDKIM();
opendkim.flush_cache(function (err, result) {
callback(err, result);
});
}
flush_cache(function (err, records) {
if (err) {
// handle error
console.log(err);
return;
}
if (records) {
console.log('flushed ' + records + ' records');
} else {
console.log('cache is off');
}
});