Software /
code /
prosody
Comparison
plugins/mod_storage_sql.lua @ 13318:4a437dd62cc9
mod_storage_sql: Use UUIDv7 as keys
Potentially allows sorting on those directly as they will be in
increasing order.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 17 Jul 2023 04:30:35 +0200 |
parent | 13242:0d3881bf29a8 |
child | 13611:3a23116cf063 |
comparison
equal
deleted
inserted
replaced
13317:e6a5f196fc1f | 13318:4a437dd62cc9 |
---|---|
364 local result = engine:delete(delete_sql, host, user or "", store, key); | 364 local result = engine:delete(delete_sql, host, user or "", store, key); |
365 if result and item_count then | 365 if result and item_count then |
366 item_count = item_count - result:affected(); | 366 item_count = item_count - result:affected(); |
367 end | 367 end |
368 else | 368 else |
369 key = uuid.generate(); | 369 key = uuid.v7(); |
370 end | 370 end |
371 local t, encoded_value = assert(serialize(value)); | 371 local t, encoded_value = assert(serialize(value)); |
372 engine:insert(insert_sql, host, user or "", store, when, with, key, t, encoded_value); | 372 engine:insert(insert_sql, host, user or "", store, when, with, key, t, encoded_value); |
373 if item_count then | 373 if item_count then |
374 archive_item_count_cache:set(cache_key, item_count+1); | 374 archive_item_count_cache:set(cache_key, item_count+1); |