In this paper, we present an improved real-time current-based approach for calculating the frequency-dependent dielectric function of a bulk periodic system, which can achieve a unified treatment of longitudinal and transverse macroscopic geometries on the same footing, and an improvement to make the approach of calculating dielectric function more robust for the avoidance of numerical divergencies at low frequency near zero in some specific cases. The validity of the improved approach implementation is verified by calculating the dielectric function of bulk periodic system in the ground in the longitudinal geometry, enabling the improved approach to be extended to excited bulk periodic systems in the transverse geometry. Further, a phenomenological description of decoherence has been incorporated within the framework of time-dependent density-functional theory (TDDFT). It is concluded that the decoherence model can suppress the numerical divergence of low frequency and grows the excitonic feature of silicon, although it adopts the approximate time-dependent exchange-correlation potential. Thus, the use of the decoherence TDDFT model opens pathways for handling the decoherence effects within the framework of TDDFT.