Door closer is a great mechanism - at it's heart is a dashpot - and a check valve. If you have a check valve in parallel to the dashpot, that accomplishes the desired function. Watch below:
This is your mechanism at rest. You could add a spring to the bottomtop of the dashpot to force it to go back to the fully closed state when finished - but that would clutter up this illustration.
When you pull on the piece:
The fluid flows through the check valve, (as the flow pushes on the ball it forces the spring down, allowing plenty of flow). Note check valves work in a variety of ways, but the ball and spring is shown here. Since the fluid flows easily, the device can extend as far as the dashpot allows.
When pushing the mechanism back, the check valve doesn't allow the fluid to flow. As a result, the load must push back slowly as the highly viscous fluid moves around the plunger to let it sink back in to place.