Hello! Try to use that library for kv store in FastAPI app.
Workers from ginicorn connect with AccessType.read_only(False) and Primary connect with AccessType.read_write().
Writer:
opt = Options(raw_mode=True)
opt.set_max_background_jobs(4)
opt.set_write_buffer_size(1024 * 1024 * 256)
opt.create_if_missing(True)
opt.set_keep_log_file_num(1)
opt.set_db_log_dir(logs_path)
opt.set_optimize_filters_for_hits(True)
opt.optimize_for_point_lookup(1024)
opt.set_max_open_files(1000)
opt.set_wal_dir(wal_path)
opt.set_wal_size_limit_mb(100)
opt.set_wal_ttl_seconds(180)
opt.set_max_total_wal_size(67108864)
opt.set_wal_recovery_mode(DBRecoveryMode.absolute_consistency())
db = Rdict(data_path, options=opt, access_type=AccessType.read_write())
Reader:
opt = Options(raw_mode=True)
opt.set_max_background_jobs(4)
opt.set_write_buffer_size(1024 * 1024 * 256)
opt.create_if_missing(True)
opt.set_keep_log_file_num(1)
opt.set_db_log_dir(logs_path)
opt.set_optimize_filters_for_hits(True)
opt.optimize_for_point_lookup(1024)
opt.set_max_open_files(1000)
opt.set_wal_dir(wal_path)
opt.set_wal_size_limit_mb(100)
opt.set_wal_ttl_seconds(180)
opt.set_max_total_wal_size(67108864)
opt.set_wal_recovery_mode(DBRecoveryMode.absolute_consistency())
db = Rdict(data_path, options=opt, access_type=AccessType.read_only(False))
So, when I change the values, readers don't see the changes without re-opening the database.
As example:
Write process:
db[bytes.fromhex("abcd12")] = 1.to_bytes(1, "little")
db.flush()
db.flush_wal()
Read process:
int.from_bytes(db[bytes.fromhex("abcd12")], "little") # not found
db = Rdict(data_path, options=opt, access_type=AccessType.read_only(False))
int.from_bytes(db[bytes.fromhex("abcd12")], "little") # found: 1
What am I doing wrong?
Hello! Try to use that library for kv store in FastAPI app.
Workers from ginicorn connect with AccessType.read_only(False) and Primary connect with AccessType.read_write().
Writer:
Reader:
So, when I change the values, readers don't see the changes without re-opening the database.
As example:
Write process:
Read process:
What am I doing wrong?