To reduce the long term electricity cost of smart appliances (SAs) with deferrable operation time in smart grid, we propose a novel energy buffering framework to intelligently schedule the distributed energy storage (DES) for the cost reduction of SAs in this paper. The proposed energy buffering framework determines the action policy (e.g., charging or discharging) and the power allocation policy of the DES to provide DES power to proper SAs at proper time with lower price than that of the utility grid, resulting in the reduction of the long term financial cost of SAs. Specifically, we first formulate the optimal decision problem in the energy buffering framework as a discounted cost Markov decision process (MDP) over infinite-horizon. Then, we propose an optimal scheme for the energy buffering framework to solve the discounted cost MDP based on online learning approach. Extensive simulation results show that the proposed optimal scheme for the energy buffering framework can significantly reduce the long term financial cost comparing with the baseline schemes and the myopic scheme.