The last time I went to O’Connor’s bar, the old timers (bless them) were trying to remember the names of all four of actor John Derek’s wives.

In the daytime, O’Connor’s was dominated by salty Brooklyn lifers who’d seen it all. In its final years — the bar closed in 2011 — I’d often go there on weekday afternoons to write. As an internet-free zone, it was conducive to cranking out pages of prose without the distractions of social media or the temptation to play online Scrabble.

So important are bars in the world of television comedies that, as I listened to the regulars at O’Connor’s enumerate (with great patience and no recourse to smartphones) the names Bo Derek, Ursula Andress, and Linda Evans that afternoon, I remember thinking, This is like a scene in a sitcom. It was something I could’ve imagined playing out on “Cheers,” or at Moe’s, in the early days of “The Simpsons.” Today, I could maybe imagine it in the new bar-centric comedy, “Abby’s,” which premiered last week on NBC.

I thought about those guys at O’Connors while I watched the first three episodes of “Abby’s,” which is set in sunny San Diego. In the outdoor bar (something that sadly would never work year-round in many parts of the country) one of the regulars — a sad-faced, silent old man named Skip — would’ve fit right in at the old Brooklyn dive. And, as at O’Connor’s, disputes at Abby’s must be settled without the benefit of Google; at Abby’s bar, there’s a bookcase full of reference books available if necessary.

But this isn’t because Abby’s lacks Wi-Fi; it’s because cell phone use is a violation of the strictly maintained house rules (of which there are 162 in total, known by heart by the excellently-named Rosie, the bar’s second-in-command). One significant difference between the fictional Abby’s and the real O’Connor’s is that, whereas O’Connor’s might have occasionally felt lawless, Abby’s exists outside the law: It’s an illegal venue, set in the backyard of its proprietor’s San Diego house — which both creates the need for all those rules, and renders their existence an amusing irony.

Another major difference is that, as its title suggests, the fictional bar has a woman in charge, played by Natalie Morales, who also happens to be a Latinx, openly bisexual publican. She is temperamental and charismatic, gruff but protective of the people who make up the bar’s proxy family, both the staff and its regulars. “This is more than just a bar,” Abby says in the pilot. “It’s a community center.”

She captures the sentiments of countless bar regulars I’ve known in real life, including my own. We all know we can drink less expensively, and more conveniently, in our own living rooms than we can in bars. (We also know that if wine’s your preference — as it is for Beth, another regular at Abby’s — it’s almost always better at home). What regulars seek is community, and the company of others who are separate from our families and our coworkers, and who exist in a space that is itself set apart from home and office.

Without ever suggesting that it had an overt agenda of any kind that I could discern, “Cheers,” which premiered in 1982 and aired its final episode in 1993, served as an essential counterweight to the hotly consumerist impulses of the 1980s and to the glorification of ambition and greed that was sometimes evident in the era’s cultural productions.

“Cheers” understood that people still yearned for community, and for public spaces that were welcoming to know-it-all postmen and oddball intellectuals — places not meant for the J.R. Ewings or Gordon Gekkos of the world. They wouldn’t have wanted to hang out at a place like “Cheers,” with a guy like Norm, and they wouldn’t have been Norm’s first choice in drinking buddies, either. But, with its open spirit, the bar would’ve welcomed them anyway — at least, I imagine, until Carla discovered how badly rich people tip and promptly 86’ed them.

The most iconic bar in television in the post-“Cheers” era is arguably Paddy’s, the south Philly dive where most of the action in “It’s Always Sunny in Philadelphia” takes place. But its gleeful, how-low-can-we go amorality sometimes feels like a deliberate subversion of “Cheers’” democratic decency. Paddy’s customers are largely beside the point; the people who most rely on Paddy’s to provide community are those who own and operate it. I may find their misadventures hilarious, but would I want to drink with them?

Kaitlin Olson as Dee, Rob McElhenney as Mac, Danny DeVito as Frank, Charlie Day as Charlie, Glenn Howerton as Dennis. in "It's Always Sunny in Philadelphia." Patrick McElhenney / FXX

I suspect I’d enjoy a drink at Abby’s, even as I’d bristle against the bar’s rules and hierarchy. But knowing that its proprietor is serious about cultivating community, I’d give her bar a shot — if she would let me. I love that it’s run by a woman, and that its bar family is more diverse than those I usually observe both on screen and in real life. I’d welcome more cell-phone-free bars, and there are few pub features that win me over faster than overflowing bookshelves.

As for those guys at O’Connor’s: It was John Derek’s first wife that stumped them. I confess that I Googled when I got home; she was a ballerina named Pati Behrs. I hope there’s a book at Abby’s that would clear that up, should the need ever arise.