Reduce code duplication in Dalli::Server

These patches try to improve the code quality of `Dalli::Server` by reducing the amount of duplicate code.