The word "have" has several meanings.
It can indicate that you are required or obligated to do something. Like, "I have to work overtime today." I don't want to, but my boss insists.
It can also indicate the past perfect tense. "I have worked overtime many weekends." In this case it has nothing to do with being required to do it. I might just as well say, "I have eaten ice cream."
When you use "have" to indicate past perfect, you should use the particle form of the verb. "I have spent", not "I have spending".
- Update in response to comment/question *
The past perfect, like "had spent", means that the action happened before some other action. The "other action" may be spelled out, or may be implied, but should be clear from the context. Like, "In 2010 I got a job in France. I HAD LIVED 10 years in Germany." The use of the past perfect tells the reader that the time in Germany was before some other time. From the context, presumably before getting the job in France.
The simple past, like "spent", means that the action happened in the past, without specifying whether it was before or after any other action.
But I'm speaking of the grammar of a verb tense. Other words in a sentence might make clear that one action came before another. Life if you say, "Before I got the job in France, I lived in Germany for ten years", the word "before" tells us that the time in Germany came before the time in France. We don't need to use a past perfect to convey that meaning.
So, "I left the cafe after having spent one hour there" and "I left the cafe after spending one hour there" both mean the same thing. The past perfect in the first case tells us that the one hour spent came before some other time. But the word "after" tells us that anyway. Perhaps with some creativity you could come up with a sentence where you would need the past perfect to make it clear just what times the "after" was referring to. But in this case, it doesn't matter.
If you're trying to say that something was required and also use a past perfect, you end up using the word "have" (or some form of "have", like "had" or "having") twice. Like, "After having to have spent one hour at the cafe ..." This can sound awkward and confusing, so we usually reword the sentence to use a simple past or an infinitive. "I had to spend one hour at the cafe, and after I left I ..." Or use a different word to express the requirement. Like, "After I was forced to have spent one hour at the cafe ..."