There's many ways to accomplish this. The voting data for the Voting API module is stored in the votingapi_vote
& votingapi_cache
tables. Essentially, you need a way to target the vote data you wish to eliminate in these tables (e.g. via a DB query) and then build some process on which to regularly execute it (e.g. a cron run).
A crude example would be a custom module that evokes hook_cron()
to check the last query execution and fire it if it hits its time threshold:
/**
* Implements hook_cron().
*/
function MYMODULE_cron() {
// Clear the vote every week.
$vote_clear_timestamp = variable_get('MYMODULE_vote_clear_timestamp', 0);
if ($vote_clear_timestamp <= strtotime('-1 week')) {
// A more targeted process would use db_delete() to target criteria
db_query("TRUNCATE {votingapi_vote}");
db_query("TRUNCATE {votingapi_cache}");
variable_set('MYMODULE_vote_clear_timestamp', time());
}
}