Fix: control of tokyocabinet optimization through env variables

First change: makes sure that threshold is correctly set
second:       threshold = 0 means "no optimization at all", completely skip the optimization process in such case
Merge pull request #749 from awsiv/fixoptimization_control

Fix: control of tokyocabinet optimization through env variables