I have been using the data_buckets table alot lately.
Anyways, I have noticed that in the use of :
Code:
quest::get_data(std::string bucket_key)
quest::set_data(std::string bucket_key, std::string bucket_value, std::string expires_in)
quest::delete_data(std::string bucket_key)
delete_data does not seem to work using perl.
Perhaps there is a delay from the time you call to delete the bucket and the actual time it is deleted from the database table?
It isn't a big deal. I just use an sql query to remove the buckets when needed, I was just curious if I missed something in my application of the functions.
Here is a very simple script that will show what I am talking about.
Code:
sub EVENT_SAY {
if($text=~/Hail/){
$client->Message(12,"" . quest::saylink("Make Bucket", 1) . "");
$client->Message(12,"" . quest::saylink("Get Bucket", 1) . "");
$client->Message(14,"" . quest::saylink("Delete Bucket", 1) . "");
$client->Message(14,"" . quest::saylink("Delete Bucket SQL", 1) . "");
}
if($text=~/Make Bucket/){ #Bucket set to 1 hour.
quest::set_data("testkey", "5", 3600);
$client->Message(12,"Data Bucket set.");
}
if($text=~/Get Bucket/){ #Displays the value of "testkey" which is 5.
$client->Message(12,"Data Bucket value is : (" . quest::get_data(testkey) . ")");
}
if($text=~/Delete Bucket/){ #Should work but doesn't.
$client->Message(12,"Attempting to delete the data bucket...");
quest::delete_data("testkey");
$client->Message(12,"Data Bucket value is : (" . quest::get_data(testkey) . ")");
}
if($text=~/Delete Bucket SQL/){ #Works, just a little more code.
$client->Message(12,"Attempting to delete the data bucket using SQL query...");
$connect = plugin::LoadMysql();
$sql_query = ("DELETE FROM data_buckets WHERE data_buckets.key='testkey'");
$sql_handler = $connect->prepare($sql_query);
$sql_handler->execute();
$connect->disconnect;
$client->Message(12,"Data Bucket value is : (" . quest::get_data(testkey) . ")");
}
}