1

Anyone can tell me how to call command BGSAVE from BookSleeve to Redis?

I search a lot in BookSleeve available methods but not found any commands relative to SAVE or BGSAVE.

Thanks!

langtu
  • 1,198
  • 1
  • 10
  • 23

1 Answers1

2

Yes, it would seem that I never got around to adding that; I don't think SHUTDOWN is there either. In both cases, I expect they simply weren't things that are commonly performed at the reqest if a client - but are usually either automated (persistence configuration), or instigated at the command line (manually or as part of a script) as part of routine maintenance operations.

I can get it added for the next build (probably with the "connection has admin commands enabled" check).

A truly hacky workaround for now (untested) would be:

.Scripting.Eval(0, "return redis.call('bgsave')", null, null);

(caveat: the above makes me shudder)

But again: if your application is just performing routine work, I would probably recommend using automatic redis persistence settings. If your application is a monitoring / maintenance front end, then SAVE doesn't seem too inappropriate.

but not found any commands relative to SAVE or BGSAVE.

Actually, I would strongly advise avoiding SAVE on a production server, unless you know it is safely off to one side and not being used; BGSAVE is not so invasive.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • I'm trying your `Eval` hack for SHUTDOWN now but it would be nice to have that in the API as well. I filed [Issue 55 on Google Code](https://code.google.com/p/booksleeve/issues/detail?id=55) to request it. – jtb Feb 10 '14 at 23:03
  • @jtb noted; I have to say it isn't something that most people use very often, but by that token neither is `FlushAll`, so if *that* is on the API, I can't think of a good reason not to have shutdown – Marc Gravell Feb 11 '14 at 11:08