@@ -407,7 +407,7 @@ class AsyncRedis {
407407 Future<void > mset (std::initializer_list<T> il) {
408408 return mset (il.begin (), il.end ());
409409 }
410-
410+
411411 template <typename Input, typename Callback>
412412 auto mset (Input first, Input last, Callback &&cb)
413413 -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<void> &&>::value, void>::type {
@@ -507,6 +507,71 @@ class AsyncRedis {
507507 fmt::set_keepttl, key, val, keepttl, type);
508508 }
509509
510+ Future<OptionalString> set_with_get_option (const StringView &key,
511+ const StringView &val,
512+ const std::chrono::milliseconds &ttl = std::chrono::milliseconds(0 ),
513+ UpdateType type = UpdateType::ALWAYS) {
514+ return _command<OptionalString>(fmt::set_with_get_option, key, val, ttl, type);
515+ }
516+
517+ template <typename Callback>
518+ auto set_with_get_option (const StringView &key,
519+ const StringView &val,
520+ Callback &&cb)
521+ -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<OptionalString> &&>::value, void>::type {
522+ _callback_fmt_command<OptionalString>(std::forward<Callback>(cb),
523+ fmt::set_with_get_option, key, val, std::chrono::milliseconds (0 ), UpdateType::ALWAYS);
524+ }
525+
526+ template <typename Callback>
527+ auto set_with_get_option (const StringView &key,
528+ const StringView &val,
529+ const std::chrono::milliseconds &ttl,
530+ Callback &&cb)
531+ -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<OptionalString> &&>::value, void>::type {
532+ _callback_fmt_command<OptionalString>(std::forward<Callback>(cb),
533+ fmt::set_with_get_option, key, val, ttl, UpdateType::ALWAYS);
534+ }
535+
536+ template <typename Callback>
537+ auto set_with_get_option (const StringView &key,
538+ const StringView &val,
539+ const std::chrono::milliseconds &ttl,
540+ UpdateType type,
541+ Callback &&cb)
542+ -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<OptionalString> &&>::value, void>::type {
543+ _callback_fmt_command<OptionalString>(std::forward<Callback>(cb),
544+ fmt::set_with_get_option, key, val, ttl, type);
545+ }
546+
547+ Future<OptionalString> set_with_get_option (const StringView &key,
548+ const StringView &val,
549+ bool keepttl,
550+ UpdateType type = UpdateType::ALWAYS) {
551+ return _command<OptionalString>(fmt::set_with_get_keepttl_option, key, val, keepttl, type);
552+ }
553+
554+ template <typename Callback>
555+ auto set_with_get_option (const StringView &key,
556+ const StringView &val,
557+ bool keepttl,
558+ Callback &&cb)
559+ -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<OptionalString> &&>::value, void>::type {
560+ _callback_fmt_command<OptionalString>(std::forward<Callback>(cb),
561+ fmt::set_with_get_keepttl_option, key, val, keepttl, UpdateType::ALWAYS);
562+ }
563+
564+ template <typename Callback>
565+ auto set_with_get_option (const StringView &key,
566+ const StringView &val,
567+ bool keepttl,
568+ UpdateType type,
569+ Callback &&cb)
570+ -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<OptionalString> &&>::value, void>::type {
571+ _callback_fmt_command<OptionalString>(std::forward<Callback>(cb),
572+ fmt::set_with_get_keepttl_option, key, val, keepttl, type);
573+ }
574+
510575 Future<long long > strlen (const StringView &key) {
511576 return _command<long long >(fmt::strlen, key);
512577 }
0 commit comments