BUG: fix datetimes.should_cache() error for deque (GH 29403)
`itertools.islice()` should be used to get slice of a deque. `itertools.islice()` also can be used (and is efficient) for other collections. So `unique(arg[:check_count])` was replaced with `set(islice(arg, check_count))` which is also much faster on test data. 

- [x] closes #29403
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry
